public async Task <T> AddAsync(T entity)
        {
            _dbContext.Set <T>().Add(entity);
            await _dbContext.SaveChangesAsync();

            return(entity);
        }
Esempio n. 2
0
 public async Task <IReadOnlyList <T> > GetAllAsync()
 {
     return(await _dbContext.Set <T>().ToListAsync());
 }
Esempio n. 3
0
 public GenericRepo(WebAppContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }
Esempio n. 4
0
 protected RepositoryBase(WebAppContext dbContext)
 {
     this.dbContext = dbContext;
     dbSet          = dbContext.Set <T>();
 }
 public GenericRepository(WebAppContext context)
 {
     this.context = context;
     dbSet        = context.Set <TEntity>();
 }