protected async Task <IEnumerable <T> > GetAllAsync <T>(string[] includes = null) where T : class { var query = _context.Set <T>().AsQueryable(); if (includes != null) { query = includes.Aggregate(query, (query, include) => query.Include(include)); } return(await query.ToListAsync()); }
public Repository(OnlineShopContext context) { Context = context; DbSet = context.Set <T>(); }
public void Create(TEntity entity) { Context.Set <TEntity>().Add(entity); Context.SaveChanges(); }
public virtual TEntity GetById(Guid id) { return(Context.Set <TEntity>().Find(id)); }
public TEntity GetbyId(Guid id) { return(context.Set <TEntity>().Find(id)); }
public void Add(T item) { _context.Set <T>().Add(item); }
public GenericRepository(OnlineShopContext DBEntity) { _DBEntity = DBEntity; _dbSet = _DBEntity.Set <Tbl_Entity>(); }
public SqlDB() { table = _dbContext.Set <T>(); }