Example #1
0
        public IList <T> GetData(Func <T, bool> where, params Expression <Func <T, object> >[] navigations)
        {
            List <T>       list;
            IQueryable <T> query = db.Set <T>();

            foreach (Expression <Func <T, object> > item in navigations)
            {
                query = query.Include <T, object>(item);
            }
            list = query.AsNoTracking()
                   .Where(where)
                   .ToList();
            return(list);
        }
Example #2
0
 public bool Update(T obj)
 {
     using (var d = new PlasticFactoryEntities())
         try
         {
             DbSet dSet = d.Set <T>();
             dSet.Attach(obj);
             d.Entry(obj).State = EntityState.Modified;
             d.SaveChanges();
             return(true);
         }
         catch
         {
             throw;
         }
 }
Example #3
0
 public Responsity()
 {
     this.db    = new PlasticFactoryEntities();
     this.dbSet = db.Set <T>();
 }