Forum Stats

  • 3,722,209 Users
  • 2,244,252 Discussions
  • 7,849,704 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to configure DbContext with ODP.NET Core

c0036513-d01d-46af-8a69-d47e16c6c3ce
edited April 2019 in ODP.NET

It seems that Oracle released the ODP.NET Core version (see https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/). If this is accurate, please share how to set it up by using the DbContextOptions (or in any other "injectable" way, not by manually instantiating the connection and command objects (as in https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/ODPNET_Core_get_started/index.html).

I am not able to configure the DbContext from the Startup, Configuration method as described in StackOverflow (https://stackoverflow.com/questions/52972234/options-useoracle-not-available-in-ef-core ):

services.AddDbContext<BloggingContext>(options => options.UseOracle(ora_conn)); 

<span style="font-family: arial, helvetica, sans-serif;">"UseOracle" is not a method that is available.</span><br/>

I have included the following namespaces:

using Oracle.ManagedDataAccess.Client;

using Microsoft.EntityFrameworkCore;

Even when I try dotnet ef dbcontext scaffold (with and without the option -c HiddenContext), it fails with the error "Unable to find expected assembly attribute named DesignTimeProviderServicesAttribute in provider assembly Oracle.ManagedDataAccess. This attribute is required to identify the class which acts as the design-time service provider factory."

dotnet ef dbcontext scaffold "DATA SOURCE=hidden;PASSWORD=hidden;PERSIST SECURITY INFO=True;USER ID=hidden;Connection Timeout=60;min pool size=0;connection lifetime=1800;" Oracle.ManagedDataAccess --output-dir Tables --schema hidden -t table1 -t table2 -t table3 -t table4 -t table 5 -v

What am I missing? Can anybody point me to any suggestions out there?

Please, please, help...

c0036513-d01d-46af-8a69-d47e16c6c3ce383787966aed53f-0401-48d6-bf2f-390fe8ae1d95

Best Answer

  • Mark Williams
    Mark Williams Member Posts: 67 Blue Ribbon
    edited October 2018 Accepted Answer

    Hi,

    What your NuGet link points to is the Oracle Data Provider for .NET Core (ODPC) which is different from the Oracle Provider for Entity Framework Core. The EF provider is a separate assembly which has not been released yet (as of this posting date). The EF assembly will require the ODPC assembly.

    Regards,

    Mark

    c0036513-d01d-46af-8a69-d47e16c6c3cec0036513-d01d-46af-8a69-d47e16c6c3ce
«1

Answers

Sign In or Register to comment.