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
I added a new table to my database which participates in a one to many relationship with another table. When I scaffold the migration I get the following code.
Upon applying this migration I get the following error.
Applying explicit migrations: [201608200256366_MigTemplateDefs].
Applying explicit migration: 201608200256366_MigTemplateDefs.
The Foreign Key on table 'TemplateDefinition' with columns 'InputViewModelId' could not be created because the principal key columns could not be determined. Use the AddForeignKey fluent API to fully specify the Foreign Key.
The BusinessDomainDefinition table was created in a previous migration and has a primary key. There are also several other 1 to many child tables created in the initial migration that are applied without the same error.
The issue
EF Migrations should be able to apply this without an issue. It is a simple 1 to many relationship. If I delete all migrations and re scaffold the entire database the update works without any problem.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:
Stack trace:
Further technical details
EF Version 6.1.3
Visual Studio 2015 Community
Other details about my project setup:
The text was updated successfully, but these errors were encountered:
Steps to reproduce
I added a new table to my database which participates in a one to many relationship with another table. When I scaffold the migration I get the following code.
Upon applying this migration I get the following error.
The BusinessDomainDefinition table was created in a previous migration and has a primary key. There are also several other 1 to many child tables created in the initial migration that are applied without the same error.
The issue
EF Migrations should be able to apply this without an issue. It is a simple 1 to many relationship. If I delete all migrations and re scaffold the entire database the update works without any problem.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Further technical details
EF Version 6.1.3
Visual Studio 2015 Community
Other details about my project setup:
The text was updated successfully, but these errors were encountered: