You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The migration files are created using command dotnet ef migrations add DbInit -c CompanyDbContext -o "Migrations\Company" -p ..\Admin.EntityFramework.SqlServer\Admin.EntityFramework.SqlServer.csproj
I expect to get a migration script for creating Company table. However, I get also script for creating Subscription table, SubscriptionType table (reference/foreign key nested in Subscription class) and IdentityUser table. But I want to create only Company table and have others being referenced by foreign keys.
@steamprodz EF Core will create migrations for all entity types in your EF model. Being able to exclude certain types from the migration is tracked by #2725. Until that issue is implemented the way to handle this is to delete from the migration the parts associated with types that you want to exclude.
Hello!
I am using EF Core and tried to implement a code-first migration according to the docs.
This is my entity model:
DbContext:
The migration files are created using command
dotnet ef migrations add DbInit -c CompanyDbContext -o "Migrations\Company" -p ..\Admin.EntityFramework.SqlServer\Admin.EntityFramework.SqlServer.csproj
I expect to get a migration script for creating Company table. However, I get also script for creating Subscription table, SubscriptionType table (reference/foreign key nested in Subscription class) and IdentityUser table. But I want to create only Company table and have others being referenced by foreign keys.
The migration script:
Is it a correct behavior? I guess it shouldn't work this way.
The text was updated successfully, but these errors were encountered: