public IList <T> GetList(Func <T, bool> where, params Expression <Func <T, object> >[] navigationproperties) { List <T> list; using (var context = new CardProcessingEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; IQueryable <T> dbquery = context.Set <T>(); // eager loading foreach (Expression <Func <T, object> > navigationProperty in navigationproperties) { dbquery = dbquery.Include(navigationProperty); } list = dbquery.AsNoTracking().Where(where).ToList(); } return(list); }
public T GetSingle(Func <T, bool> where, params Expression <Func <T, object> >[] navigationproperties) { T item; using (var context = new CardProcessingEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; IQueryable <T> dbquery = context.Set <T>(); // eager loading foreach (Expression <Func <T, object> > navigationProperty in navigationproperties) { dbquery = dbquery.Include(navigationProperty); } item = dbquery.AsNoTracking().SingleOrDefault(where); } return(item); }
public IList <T> GetAllWithPaging(int limit, int upset, params Expression <Func <T, object> >[] navigationproperties) { List <T> list; using (var context = new CardProcessingEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; IQueryable <T> dbquery = context.Set <T>(); // eager loading foreach (Expression <Func <T, object> > navigationProperty in navigationproperties) { dbquery = dbquery.Include(navigationProperty); } list = dbquery.AsNoTracking().ToList().Skip(limit * upset).Take(limit).ToList(); } return(list); }