Reputation: 4943
I have an Sql Server View that returns a combination of a few different tables.
Is it possible to add in a relationship from the View to a foreign table so that Entity Framework could pick up on the relationship and add in foreign key constraint?
Upvotes: 0
Views: 273
Reputation:
Is it possible to add in a relationship from the View to a foreign table
No.
so that Entity Framework could pick up on the relationship and add in foreign key constraint?
Entity Framework does not require a relationship to be backed by a foreign key constraint in the database. Even though you cannot add a foreign key constraint on a view in the database, you can still map the relationship in Entity Framework the same way you would for a table. It just won't be detected automatically for you.
Upvotes: 1