public UnitOfWork(IServiceProvider serviceProvider, IDbContext context) { Check.NotNull(serviceProvider, nameof(serviceProvider)); _context = context; _dbContext = _context.AsDbContext(); _repositoryFactory = serviceProvider.GetRequiredService <IRepositoryFactory>(); }
public ReadOnlyRepository(IUnitOfWork unitOfWork) { Check.NotNull(unitOfWork, nameof(unitOfWork)); _unitOfWork = unitOfWork; _context = unitOfWork.DbContext; _set = _context.AsDbContext().Set <TEntity>(); }
public SqlExecutorBase(IDbContext dbContext) { if (dbContext is null) { throw new ArgumentNullException(nameof(dbContext)); } _connectionString = dbContext.AsDbContext().Database.GetDbConnection().ConnectionString; }
public void BatchInsert(IList <TEntity> entities) { Check.NotNull(entities, nameof(entities)); _context.AsDbContext().BulkInsert(entities); }