public static void UseSqlite <TDbContext>( [NotNull] this AbpDbContextOptions options, [CanBeNull] Action <SqliteDbContextOptionsBuilder> sqliteOptionsAction = null) where TDbContext : AbpDbContext <TDbContext> { options.Configure <TDbContext>(context => { context.UseSqlite(sqliteOptionsAction); }); }
public static void UseOracle <TDbContext>( [NotNull] this AbpDbContextOptions options, [CanBeNull] Action <OracleDbContextOptionsBuilder> oracleOptionsAction = null, bool useExistingConnectionIfAvailable = false) where TDbContext : AbpDbContext <TDbContext> { options.Configure <TDbContext>(context => { context.UseOracle(oracleOptionsAction, useExistingConnectionIfAvailable); }); }
public UnitOfWorkDbContextProvider( IUnitOfWorkManager unitOfWorkManager, IConnectionStringResolver connectionStringResolver, ICancellationTokenProvider cancellationTokenProvider, ICurrentTenant currentTenant, IOptions <AbpDbContextOptions> options) { _unitOfWorkManager = unitOfWorkManager; _connectionStringResolver = connectionStringResolver; _cancellationTokenProvider = cancellationTokenProvider; _currentTenant = currentTenant; _options = options.Value; Logger = NullLogger <UnitOfWorkDbContextProvider <TDbContext> > .Instance; }
private static void PreConfigure <TDbContext>( AbpDbContextOptions options, AbpDbContextConfigurationContext <TDbContext> context) where TDbContext : AbpDbContext <TDbContext> { foreach (var defaultPreConfigureAction in options.DefaultPreConfigureActions) { defaultPreConfigureAction.Invoke(context); } var preConfigureActions = options.PreConfigureActions.GetOrDefault(typeof(TDbContext)); if (!preConfigureActions.IsNullOrEmpty()) { foreach (var preConfigureAction in preConfigureActions) { ((Action <AbpDbContextConfigurationContext <TDbContext> >)preConfigureAction).Invoke(context); } } }
private static void Configure <TDbContext>( AbpDbContextOptions options, AbpDbContextConfigurationContext <TDbContext> context) where TDbContext : AbpDbContext <TDbContext> { var configureAction = options.ConfigureActions.GetOrDefault(typeof(TDbContext)); if (configureAction != null) { ((Action <AbpDbContextConfigurationContext <TDbContext> >)configureAction).Invoke(context); } else if (options.DefaultConfigureAction != null) { options.DefaultConfigureAction.Invoke(context); } else { throw new AbpException( $"No configuration found for {typeof(DbContext).AssemblyQualifiedName}! Use services.Configure<AbpDbContextOptions>(...) to configure it."); } }