public RepositoryBase(InsuranceDbContext context) { string exString = @"Null DbContext"; if (dbContext == null) { throw new ArgumentNullException(exString); } dbContext = context; DbSet = context.Set <T>(); }
public async Task Create(TEntity entity) { await Context.Set <TEntity>().AddAsync(entity); await Context.SaveChangesAsync(); }
public async Task <bool> IsExist <TEntity>(TEntity entity, CancellationToken cancellationToken) where TEntity : class { return(await _context.Set <TEntity>().ContainsAsync(entity, cancellationToken)); }
public Task <List <T> > GetAllAsync() { return(_context.Set <T>().ToListAsync()); }