Example #1
0
 public void Remove(params T[] items)
 {
     using (var context = new BankManagementEntities())
     {
         foreach (T item in items)
         {
             context.Entry(item).State = System.Data.Entity.EntityState.Deleted;
         }
         context.SaveChanges();
     }
 }
Example #2
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>());
            }
        }
Example #3
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);
        }
Example #4
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);
        }