Monday, February 08, 2010

ADO.Net Entity Data Model – beginner mistakes

Are you getting the “Unable to update the EntitySet ‘xxxx’ because it has a DefiningQuery and no <InsertFunction>”

Check to make sure your table has a primary key – I think the reason that you get this error is that because your table does not have a primary key, EF looks at your table like a view that is not directly updatable and needs special logic (either through .Net code or a stored procedure) to update the table.

Set the primary key, delete the EF model and then re-add it (just refreshing the model didnt do it for me). And you should be back in business.

No comments: