예제 #1
0
 public void Delete(T entity)
 {
     using (var dataContext = new AntContext())
     {
         dataContext.Set <T>().Remove(entity);
         dataContext.SaveChanges();
     }
 }
예제 #2
0
 public void Add(T entity)
 {
     using (var dataContext = new AntContext())
     {
         dataContext.Set <T>().Add(entity);
         dataContext.SaveChanges();
     }
 }
예제 #3
0
        public IQueryable <T> Find(Expression <Func <T, bool> > predicate)
        {
            using (var dataContext = new AntContext())

            {
                IQueryable <T> query = dataContext.Set <T>().Where(predicate);
                return(query);
            }
        }
예제 #4
0
        public IQueryable <T> GetAll()
        {
            using (var dataContext = new AntContext())

            {
                IQueryable <T> query = dataContext.Set <T>();
                return(query);
            }
        }
예제 #5
0
 public Repository(AntContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }