public async Task <List <TEntity> > GetAllAsync() { return(await _context.Set <TEntity>().ToListAsync()); }
public Repository(BlogAppContext context) { m_Context = context; m_DbSet = m_Context.Set <T>(); }
public Repository(BlogAppContext context) { _context = context; _dbSet = _context.Set <T>(); }
// TKey represents the column public async Task <List <T> > GetAllWithFilterDescending <TKey>(Expression <Func <T, bool> > filter, Expression <Func <T, TKey> > keySelector) { using var context = new BlogAppContext(); return(await context.Set <T>().Where(filter).OrderByDescending(keySelector).ToListAsync()); }
public async Task <T> GetByFilter(Expression <Func <T, bool> > tableFilter) { using var context = new BlogAppContext(); return(await context.Set <T>().FirstOrDefaultAsync(tableFilter)); }
public async Task <List <T> > GetAllByFilter(Expression <Func <T, bool> > tableFilter) { using var context = new BlogAppContext(); return(await context.Set <T>().Where(tableFilter).ToListAsync()); }
public async Task <List <T> > GetAll() { using var context = new BlogAppContext(); return(await context.Set <T>().ToListAsync()); }