Esempio n. 1
0
 public BaseRepository()
 {
     this.context = new AMSEntities();
     this.dbSet   = context.Set <TEntity>();
 }
Esempio n. 2
0
 public GenericRepository(AMSEntities db)
 {
     this.db = db;
     table   = db.Set <T>();
 }
Esempio n. 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());
        }
Esempio n. 4
0
 public GenericRepository()
 {
     this.db = new AMSEntities();
     table   = db.Set <T>();
 }