Ejemplo n.º 1
0
        public T GetSingle(Func <T, bool> where, params Expression <Func <T, object> >[] navigationProperties)
        {
            using (var context = new BankManagementEntities())
            {
                IQueryable <T> dbquery = context.Set <T>();

                foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
                {
                    dbquery = dbquery.Include <T, object>(navigationProperty);
                }
                return(dbquery.AsNoTracking().Where <T>(where).SingleOrDefault <T>());
            }
        }
Ejemplo n.º 2
0
        public IList <T> GetList(Func <T, bool> where, params Expression <Func <T, object> >[] navigationProperties)
        {
            List <T> list = null;

            using (var context = new BankManagementEntities())
            {
                IQueryable <T> dbquery = context.Set <T>();

                foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
                {
                    dbquery = dbquery.Include <T, object>(navigationProperty);
                }
                list = dbquery.AsNoTracking().Where <T>(where).ToList <T>();
            }
            return(list);
        }
Ejemplo n.º 3
0
        public IList <T> GetAll(params Expression <Func <T, object> >[] navigationProperties)
        {
            List <T> list = null;

            using (var context = new BankManagementEntities())
            {
                context.Configuration.ProxyCreationEnabled = false;
                IQueryable <T> dbquery = context.Set <T>();

                foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
                {
                    dbquery = dbquery.Include <T, object>(navigationProperty);
                }
                list = dbquery.AsNoTracking().ToList <T>();
            }
            return(list);
        }