Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/13 14:04:56 (12 years ago)
Author:
spimming
Message:

#1888:

  • Set flag to indicate a modified model object
  • Add dao query method to specify includes as parameter
  • cleaned up the using of namespaces to qualify types
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  
    2020    public DbSet<PaymentInformation> PaymentInformations { get; set; }
    2121
    22     // enum PaymentMethod
    23     // enum OrderState
    24 
    2522    public BillingContext()
    2623      : this("name=BillingContext") {
     
    3128      : base(connectionString) {
    3229
    33       Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer());
     30      Database.SetInitializer(new BillingContextInitiliazer());
    3431
    3532      // Hook up event to mark existing entities as Unchanged
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingDao.cs

    r9645 r9653  
    22using System;
    33using System.Collections.Generic;
    4 using System.Data;
    54using System.Data.Entity;
    65using System.Linq;
     
    1110  public class BillingDao {
    1211
    13     #region Context Creation and Execution
     12    #region Context Creation
    1413
    1514    private BillingContext CreateContext() {
     
    3231        var products = context.Products.Where(predicate).ToList();
    3332        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();
    3445      }
    3546    }
Note: See TracChangeset for help on using the changeset viewer.