Closed iyhammad closed 7 years ago
Hi,
DbContext
in the same project. Currently I'm only looking for the first DbMigrationsConfiguration
. I should be able to resolve this easily and do an update soon.@iyhammad in order to align with how the EFCore tool is doing this: if there are more than one DbContext
s, the tool should prompt you to enter the context name. So, dotnet ef database update
will fail, you should always specify the context's name: i.e dotnet ef database update -c TenantsDbContext
. The same thing applies to other commands that can be run on one of the contexts.
@mrahhal Specifying the context's name while doing these commands would be nice. It will be great to have this feature.
Alright then. I'll let you know here when I do an update (most likely today).
Resolved in 4aa9726d3ddab15286f03358ba0849adc2565f4f.
Unfortunately you'll still need to hand edit the scaffolded migration file to change the namespace. But this will do for now to unblock those who're using multiple DbContext
s.
Hi, I'm trying to use the tool to generate Migrations for EF 6 in ASPNET Core Application. I've 2 separate Db Contexts. and below is my Folder Structure -----MyApp.Data ---------Migrations -------------Host ------------------HostMigrationConfigurations.cs -------------Tenants ------------------TenantsMigrationsConfiguration.s
There are 2 issues I face in this scenario
dotnet ef migrations add --output-dir "Migrations/Host" "V0-0-0-22"
It Creates the Migration but with wrong namespace (Tenants namespace)dotnet ef database update
It doesn't run the migrations on both dbcontexts.Thanks,