Entity Framework Definning Query Error

1184
0
SHARE

I got this error “Unable to update the EntitySet because it has a DefiningQuery and no element exists in the element to support the current operation.” when trying to update a legacy database table using EntityFramework.

After doing some research, I found that, first, this legacy database does not have a primary key, then the EntityFramework treat it as a View, and created a <DefinningQuery> to treat it as ReadOnly.

How to solve it? If possible, create a primary key for the table, or

1. find the edmx file and open it with XML editor,

2. find that table definition (EntitySet),

3. change the store:Schema=”dbo” to Schema=”dbo”,

4. remove store:Name.

NO COMMENTS

LEAVE A REPLY