public T GetSingle(Func <T, bool> where, params System.Linq.Expressions.Expression <Func <T, object> >[] navigationproperties) { T item = null; using (var context = new BankManagermentEntities()) { IQueryable <T> dbquery = context.Set <T>(); // eager loading foreach (Expression <Func <T, object> > navigationProperty in navigationproperties) { dbquery = dbquery.Include <T, object>(navigationProperty); } item = dbquery.AsNoTracking().SingleOrDefault(where); } return(item); }
public IList <T> GetList(Func <T, bool> where, params System.Linq.Expressions.Expression <Func <T, object> >[] navigationproperties) { List <T> list = null; using (var context = new BankManagermentEntities()) { IQueryable <T> dbquery = context.Set <T>(); // eager loading foreach (Expression <Func <T, object> > navigationProperty in navigationproperties) { dbquery = dbquery.Include <T, object>(navigationProperty); } list = dbquery.AsNoTracking().Where(where).ToList <T>(); } return(list); }