- Timestamp:
- 06/24/13 14:04:56 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingContext.cs
r9645 r9653 20 20 public DbSet<PaymentInformation> PaymentInformations { get; set; } 21 21 22 // enum PaymentMethod23 // enum OrderState24 25 22 public BillingContext() 26 23 : this("name=BillingContext") { … … 31 28 : base(connectionString) { 32 29 33 Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer());30 Database.SetInitializer(new BillingContextInitiliazer()); 34 31 35 32 // Hook up event to mark existing entities as Unchanged -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingDao.cs
r9645 r9653 2 2 using System; 3 3 using System.Collections.Generic; 4 using System.Data;5 4 using System.Data.Entity; 6 5 using System.Linq; … … 11 10 public class BillingDao { 12 11 13 #region Context Creation and Execution12 #region Context Creation 14 13 15 14 private BillingContext CreateContext() { … … 32 31 var products = context.Products.Where(predicate).ToList(); 33 32 return products; 33 } 34 } 35 36 public IEnumerable<Product> FindProductBy(Expression<Func<Product, bool>> query, params Expression<Func<Product, object>>[] includes) { 37 using (var context = CreateContext()) { 38 IQueryable<Product> products = context.Products.Where(query); 39 40 if (includes != null) { 41 products = includes.Aggregate(products, (current, include) => current.Include(include)); 42 } 43 44 return products.ToList(); 34 45 } 35 46 }
Note: See TracChangeset
for help on using the changeset viewer.