Using ODP.NET Core Classes

Developers can use the OracleConfiguration class and other ODP.NET Core classes in Entity Framework Core to access ODP.NET Core-specific functionality, such as the TNS ADMIN location or tracing settings.

The ODP.NET Core assembly will already be part of any Oracle EF Core project since it is a dependency of Oracle.EntityFrameworkCore. Most commonly, developers will add the ODP.NET Core namespace to the project:

// C#
using Oracle.ManagedDataAccess.Client;

Then, add the desired OracleConfiguration property settings. These properties should be set prior to any EF Core code as OracleConfiguration settings must be made prior to opening an ODP.NET connection. The below example turns on tracing and sets a TNS ADMIN location which should contain the application's tnsnames.ora and sqlnet.ora files:

// C#
static void Main(string[] args)
{
    OracleConfiguration.TraceFileLocation = @"D:\traces";
    OracleConfiguration.TraceLevel = 7;
    OracleConfiguration.TnsAdmin = @"D:\tnsadmin";

    <Start Entity Framework Core code>
}

Oracle EF Core applications can use all the properties and behavior available in ODP.NET Core.