예제 #1
0
 public BaseRepository()
 {
     this.context = new AMSEntities();
     this.dbSet   = context.Set <TEntity>();
 }
예제 #2
0
 public GenericRepository(AMSEntities db)
 {
     this.db = db;
     table   = db.Set <T>();
 }
예제 #3
0
        public IQueryable <T> All <T>(string[] includes = null) where T : class
        {
            //HANDLE INCLUDES FOR ASSOCIATED OBJECTS IF APPLICABLE
            if (includes != null && includes.Count() > 0)
            {
                var query = dbContext.Set <T>().Include(includes.First());
                foreach (var include in includes.Skip(1))
                {
                    query = query.Include(include);
                }
                return(query.AsQueryable());
            }

            return(dbContext.Set <T>().AsQueryable());
        }
예제 #4
0
 public GenericRepository()
 {
     this.db = new AMSEntities();
     table   = db.Set <T>();
 }