Skip to content

SAIF.Platform.EntityFramework

Oracle EF Core integration built on Aspire.Oracle.EntityFrameworkCore, with a custom execution strategy for transient-error retries and connection-string building via OracleConnectionStringBuilder.

This package is Oracle-specific, not a generic EF Core helper — it wires up Oracle.EntityFrameworkCore and Oracle.ManagedDataAccess.Core directly and has no provider-agnostic surface.

Getting started

Register your DbContext against the platform's Oracle connection (bound to the fixed resource name oracledb, assembled from configuration plus platform-controlled data source/user id/password):

builder.AddOracleDbContext<MyDbContext>();

Both configure (an Action<OracleEntityFrameworkCoreSettings> for Aspire's standard EF Core settings) and configureOptions (an Action<OracleDbContextOptions> for connection-string tuning, e.g. pooling via OracleConnectionStringBuilder) are optional:

builder.AddOracleDbContext<MyDbContext>(
    configure: settings => settings.DisableRetry = true,
    configureOptions: options => options.ConfigureConnectionString = csb =>
    {
        csb.Pooling = true;
        csb.MaxPoolSize = 50;
    });

To retry on additional application-specific Oracle error codes beyond the defaults (ORA-12570, ORA-12571, ORA-03135), subclass OracleExecutionStrategy and use the two-type-parameter overload:

public class MyExecutionStrategy(ExecutionStrategyDependencies dependencies)
    : OracleExecutionStrategy(dependencies, [/* additional ORA-xxxxx codes */]);

builder.AddOracleDbContext<MyDbContext, MyExecutionStrategy>();

Retry attempts are tracked via the saif.entityframework.oracle.retry_attempts OpenTelemetry counter.

Known issue: transitive dependency pinning

Aspire.Oracle.EntityFrameworkCore 13.1.0 pulls in 8.x versions of several Microsoft.Extensions.* packages, which conflicts with the 10.x versions OpenTelemetry requires. This package forces the 10.x versions via direct PackageReferences to resolve the conflict — see the comment above those references in SAIF.Platform.EntityFramework.csproj. If you're upgrading Aspire.Oracle.EntityFrameworkCore in this package, re-check whether the pin is still needed or needs updating.

  • SAIF.Platform — base service defaults this package builds on.

View source on GitHub