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

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