Beispiel #1
0
 public async Task <List <TEntity> > GetAllAsync()
 {
     return(await _context.Set <TEntity>().ToListAsync());
 }
Beispiel #2
0
 public Repository(BlogAppContext context)
 {
     m_Context = context;
     m_DbSet   = m_Context.Set <T>();
 }
Beispiel #3
0
 public Repository(BlogAppContext context)
 {
     _context = context;
     _dbSet   = _context.Set <T>();
 }
Beispiel #4
0
 // 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());
 }
Beispiel #5
0
 public async Task <T> GetByFilter(Expression <Func <T, bool> > tableFilter)
 {
     using var context = new BlogAppContext();
     return(await context.Set <T>().FirstOrDefaultAsync(tableFilter));
 }
Beispiel #6
0
 public async Task <List <T> > GetAllByFilter(Expression <Func <T, bool> > tableFilter)
 {
     using var context = new BlogAppContext();
     return(await context.Set <T>().Where(tableFilter).ToListAsync());
 }
Beispiel #7
0
 public async Task <List <T> > GetAll()
 {
     using var context = new BlogAppContext();
     return(await context.Set <T>().ToListAsync());
 }