Skip to content
DocsTry Aspire
DocsTry

AspireOracleEFCoreExtensions Methods

ClassMethods2 members
Extension methods for configuring EntityFrameworkCore DbContext to Oracle database
AddOracleDatabaseDbContext(IHostApplicationBuilder, string, Action<OracleEntityFrameworkCoreSettings>, Action<DbContextOptionsBuilder>)Section titled AddOracleDatabaseDbContext(IHostApplicationBuilder, string, Action<OracleEntityFrameworkCoreSettings>, Action<DbContextOptionsBuilder>)extension
Registers the given EntityFrameworkCore.DbContext as a service in the services provided by the builder. Enables db context pooling, retries, health check, logging and telemetry for the EntityFrameworkCore.DbContext.
public static class AspireOracleEFCoreExtensions
{
public static void AddOracleDatabaseDbContext<TContext>(
this IHostApplicationBuilder builder,
string connectionName,
Action<OracleEntityFrameworkCoreSettings>? configureSettings = null,
Action<DbContextOptionsBuilder>? configureDbContextOptions = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OracleEntityFrameworkCoreSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
configureDbContextOptionsAction<DbContextOptionsBuilder>optionalAn optional delegate to configure the EntityFrameworkCore.DbContextOptions for the context.
ArgumentNullExceptionThrown if mandatory builder is null.
InvalidOperationExceptionThrown when mandatory OracleEntityFrameworkCoreSettings.ConnectionString is not provided.
Reads the configuration from "Aspire:Oracle:EntityFrameworkCore:{typeof(TContext).Name}" config section, or "Aspire:Oracle:EntityFrameworkCore" if former does not exist.
EnrichOracleDatabaseDbContext(IHostApplicationBuilder, Action<OracleEntityFrameworkCoreSettings>)Section titled EnrichOracleDatabaseDbContext(IHostApplicationBuilder, Action<OracleEntityFrameworkCoreSettings>)extension
Configures retries, health check, logging and telemetry for the EntityFrameworkCore.DbContext.
public static class AspireOracleEFCoreExtensions
{
public static void EnrichOracleDatabaseDbContext<TContext>(
this IHostApplicationBuilder builder,
Action<OracleEntityFrameworkCoreSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilder
configureSettingsAction<OracleEntityFrameworkCoreSettings>optional
ArgumentNullExceptionThrown if mandatory builder is null.
InvalidOperationExceptionThrown when mandatory EntityFrameworkCore.DbContext is not registered in DI.