コード例 #1
0
        public RepositoryBase(InsuranceDbContext context)
        {
            string exString = @"Null DbContext";

            if (dbContext == null)
            {
                throw new ArgumentNullException(exString);
            }
            dbContext = context;
            DbSet     = context.Set <T>();
        }
コード例 #2
0
        public async Task Create(TEntity entity)
        {
            await Context.Set <TEntity>().AddAsync(entity);

            await Context.SaveChangesAsync();
        }
コード例 #3
0
 public async Task <bool> IsExist <TEntity>(TEntity entity, CancellationToken cancellationToken) where TEntity : class
 {
     return(await _context.Set <TEntity>().ContainsAsync(entity, cancellationToken));
 }
コード例 #4
0
 public Task <List <T> > GetAllAsync()
 {
     return(_context.Set <T>().ToListAsync());
 }