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