Search code examples
c#odp.netasp.net-core-2.2ef-core-2.2odp.net-managed

Scaffolding an Oracle database with EF Core failing with logon denied error


I am trying to scaffold some classes from an Oracle database for use with a .NET Core Web API. I have installed the following nuget packages:

Oracle.EntityFrameworkCore - v2.18.0-beta3
Oracle.ManagedDataAccess.Core - v2.18.6

I have tried scaffolding with both providers, and I get two different errors.

Scaffold command - Scaffold-DbContext "Data Source=(DESCRIPTION=(ADDRESS_LIST= (ADDRESS=(COMMUNITY=tcpcom.world)(PROTOCOL=tcp)(HOST={Host})(PORT={Port})))(CONNECT_DATA=(SID={SID}))); User ID={UserId};Password={Password}" {Provider} -o Models

  • Oracle.EntityFrameworkCore scaffold error
    ORA-01017: invalid username/password; logon denied
    • I have confirmed my login details to be correct
  • Oracle.ManagedDataAccess scaffold 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.
    • I have tried implementing the IDesignTimeDbContextFactory<T> interface with no luck

I've tried countless things from google today with no luck. Could this be a problem with the Oracle drivers?

EDIT

I have created a .NET Core console app, installed EF Core and Oracle.EntityFrameworkCore and tried to scaffold but get the same error. Also confirmed connection string is correct by using it to create a DbContext and query a table, returning records.


Solution

  • The issue turned out to be a dollar sign $ in the password. The VS Package Manager console provides a PowerShell interface, and the $ is a reserved symbol in PowerShell, so it needed to be escaped by placing a backtick ` in front of the $.

    Answer from Oracle Community forums.