protected KnstDbContext(IEFCoreUnitOfWork efUnitOfWork) { _efUnitOfWork = efUnitOfWork; _defaultDbSessionIsUsed = true; _dbSession = _efUnitOfWork.GetDefaultDbSession() as IEFCoreDbSession; _dbSession.Attach(this); }
/// <summary> /// 初始化构造 /// 用于不同的个上下文,使用注入的工作单元 /// </summary> /// <param name="dbContext">上下文实例</param> /// <param name="service">服务集合</param> /// <param name="logger">日志</param> protected CrudControllerBase(IEFCoreUnitOfWork unitOfWork, IServiceCollection service, ILogger <Controller> logger) : base(service, logger) { _validator = service.BuildServiceProvider().GetService <FluentValidation.IValidator <TCodeTabelModel> >(); _repository = new EFCoreBaseRepository <TCodeTabelEntity>(unitOfWork.Context); _readerService = new GenericReaderService <TCodeTabelEntity, long>(logger, _repository); _writerService = new GenericWriterService <TCodeTabelEntity, long>(logger, _repository, unitOfWork); CrudDtoMapper = service.BuildServiceProvider().GetService <ICrudDtoMapper <TCodeTabelEntity, TCodeTabelModel> >(); }
public ExampleRepo(IEFCoreUnitOfWork unitOfWork) : base(unitOfWork) { }
public TestContext(IEFCoreUnitOfWork efUnitOfWork, IServiceProvider serviceProvider) : base(efUnitOfWork) { _serviceProvider = serviceProvider; }
public TestContext(IEFCoreUnitOfWork efUnitOfWork) : base(efUnitOfWork) { }
public TestEFCtxRepo(IEFCoreUnitOfWork unitOfWork) : base(unitOfWork) { }