Esempio n. 1
0
 public UnitOfWork(IServiceProvider serviceProvider, IDbContext context)
 {
     Check.NotNull(serviceProvider, nameof(serviceProvider));
     _context           = context;
     _dbContext         = _context.AsDbContext();
     _repositoryFactory = serviceProvider.GetRequiredService <IRepositoryFactory>();
 }
Esempio n. 2
0
        public ReadOnlyRepository(IUnitOfWork unitOfWork)
        {
            Check.NotNull(unitOfWork, nameof(unitOfWork));

            _unitOfWork = unitOfWork;
            _context    = unitOfWork.DbContext;
            _set        = _context.AsDbContext().Set <TEntity>();
        }
Esempio n. 3
0
        public SqlExecutorBase(IDbContext dbContext)
        {
            if (dbContext is null)
            {
                throw new ArgumentNullException(nameof(dbContext));
            }

            _connectionString = dbContext.AsDbContext().Database.GetDbConnection().ConnectionString;
        }
Esempio n. 4
0
 public void BatchInsert(IList <TEntity> entities)
 {
     Check.NotNull(entities, nameof(entities));
     _context.AsDbContext().BulkInsert(entities);
 }