public DbContext Create(out EFOptions options, string optionName = null) { options = null; if (string.IsNullOrEmpty(optionName) || optionName == _options?.OptionName) { options = _options; } else if (_multipleOptions != null && _multipleOptions.Any(x => x.OptionName == optionName)) { options = _multipleOptions.FirstOrDefault(x => x.OptionName == optionName); } if (options == null) { throw new EFUnitOfWorkException("Options is null"); } EFUnitOfWorkDbContext context = new EFUnitOfWorkDbContext(options, _logAction); return(context); }
public EFUnitOfWork(EFOptions options, Action <LogLevel, string> logAction) { _options = options; _dbFactory = new DbFactory(_options, logAction); }
public DbFactory(MultipleEFOptions multipleOptions, Action <LogLevel, string> logAction) { _multipleOptions = multipleOptions; _options = _multipleOptions.FirstOrDefault(x => x.IsDefaultOption); _logAction = logAction; }
public DbFactory(EFOptions options, Action <LogLevel, string> logAction) { _options = options; _logAction = logAction; }
public EFUnitOfWorkModule(IConfigurationRoot jimuAppSettings) : base(jimuAppSettings) { _options = JimuAppSettings.GetSection(typeof(EFOptions).Name).Get <EFOptions>(); _mulOptions = JimuAppSettings.GetSection(typeof(MultipleEFOptions).Name).Get <MultipleEFOptions>(); }
public EFUnitOfWorkDbContext(EFOptions options, Action <LogLevel, string> logAction) : base(new DbContextOptions <EFUnitOfWorkDbContext>()) { _options = options; _logAction = logAction; _loggerFactory = new LoggerFactory(); }