2

I want to create the models in entity framework core from existing oracle database , I installed the required packages for oracle database which is :

Oracle.EntityFrameworkCore 
Oracle.ManagedDataAccess.Core 
Microsoft.EntityFrameworkCore.Tools (to use Scaffold-DbContext command) 

Then when I used the following command to create the tables from database to Models folder I got this error :

PM> Scaffold-DbContext "User Id=trng;Password=fhir;Data Source=caredb:1521/care;" 

-Provider Microsoft.EntityFrameworkCore.UseOracle 

-OutputDir Models 

-Context FHIRDBContext 

-Tables APPT_CLINICS 
 
   Build started...
 
   Build succeeded.
 
   Unable to find provider assembly 'Microsoft.EntityFrameworkCore.UseOracle'. Ensure the name is correct and it's referenced by the project.

what is the correct provider for Oracle database ?

1 Answer 1

3

After searching and trying I found the solution change the provider from this :

-Provider Microsoft.EntityFrameworkCore.UseOracle 

To this code :

-Provider Oracle.EntityFrameworkCore 

And this is the complete command

PM> Scaffold-DbContext "User Id=trng;Password=fhir;Data Source=caredb:1521/care;" 

-Provider Oracle.EntityFrameworkCore

-OutputDir Models 

-Context FHIRDBContext 

-Tables APPT_CLINICS 

UPDATE :

Till now Package

Oracle.EntityFrameworkCore

is not compatible with netcoreapp 3.1 last version 6.2 install last stable version < 6 for example 5.2

Sign up to request clarification or add additional context in comments.

1 Comment

Err: PM> Scaffold-DbContext "User Id=IMART_SYSTEM;Password=69nu4Yk2099vl4wv6L41M2uX3i2D0B;Data Source=10.34.0.59:1521/tmiorcl;" -Provider Oracle.EntityFrameworkCore -OutputDir Models -Context OracleDBContext -Tables FMS_FC_JRNL_DTL Scaffold-DbContext : The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. + CategoryInfo : ObjectNotFound: (Scaffold-DbContext:String) [], CommandNotFoundException

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.