It has a DefiningQuery but no InsertFunction element… err

Well when a table is encountered without a PrimaryKey it is treated as a View.

And views show up in the EDMX file (open in an XML editor to see) in the StorageModel\EntitySet[n]\DefiningQuery element.

When you have a DefiningQuery the Entity becomes readonly unless you add modification functions. You need 3 modifications functions (aka Stored Procedures) one for each of Insert, Update and Delete.

But you have two options:

Change the key definion:

  1. And convince the EF that what it thinks is a view is really a table
  2. Or add the appropriate modification functions

In your case I recommend (1).

Leave a Comment