I have 2 EF Core DBContexts in my WebAPI project.
One is an OracleContext - Oracle.EntityFrameworkCore(2.19.70).
The OracleContext is an existing database where I have already made repositories for querying read-only data.
Second is an SQLServerContext - EFCore(3.1.5)
The SQLServerContext is a code-first approach for writing the rest of the app's functionality.
Whenever I try to run Add-Migration InitialCreate -Context SQLServerContext -OutputDir Migrations\SqlServerMigrations it gives me an error:
Method 'get_Info' in type 'Oracle.EntityFrameworkCore.Infrastructure.Internal.OracleOptionsExtension' from assembly 'Oracle.EntityFrameworkCore, Version=2.0.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342' does not have an implementation.
I believe Add-Migration is also trying to execute the OracleContext but I wanted the SQLServerContext only to generate migration files, How can I achieve this?
[EDIT] - Each DBContexts lives on its own dotnet core library classes. - WebAPI project is the startup project.
For Add Migration In Asp.Net Core 3.1 in visual studio use below code:
Add-Migration yourMigrationName -Context youSpecificContextName
Need to specify the context. In terminal, switch to project which contains migration folder. Use below command
dotnet ef migrations add --context YourApp.YourAppDbContext '<MigrationName>'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With