Example #1
0
 public IEnumerable <T> GetAll(string[] includes = null)
 {
     if (includes != null && includes.Count() > 0)
     {
         var query = dataContext.Set <T>().Include(includes.First());
         foreach (var include in includes.Skip(1))
         {
             query = query.Include(include);
         }
         return(query.AsQueryable());
     }
     return(dataContext.Set <T>().AsQueryable());
 }
Example #2
0
        public IEnumerable <T> GetAll(string[] includes = null)
        {
            //HANDLE INCLUDES FOR ASSOCIATED OBJECTS IF APPLICABLE
            if (includes != null && includes.Count() > 0)
            {
                var query = dataContext.Set <T>().Include(includes.First());
                foreach (var include in includes.Skip(1))
                {
                    query = query.Include(include);
                }
                return(query.AsQueryable());
            }

            return(dataContext.Set <T>().AsQueryable());
        }
Example #3
0
 public WebShopRepository()
 {
     _context = new WebShopDbContext();
     _dbSet   = _context.Set <TEntity>();
 }
Example #4
0
        public void Add(T instance)
        {
            var set = _webShopDbContext.Set <T>().Add(instance);

            SubmitChanges();
        }