Tuesday, September 18, 2012

Problem in mapping fragments starting at line (xxx):All the key properties (____) of the EntitySet ____ must be mapped to all the key properties

Issue:
Error 3003: Problem in mapping fragments starting at line xxx:All the key properties (table.column) of the EntitySet table must be mapped to all the key properties (table.column, table.column) of table table.

Cause:
The most common cause of this issue is when there are some key constrain changes in the database and these changes are not properly reflected in the Entity Model. Usually the change is reflected in the Database mapping in the Entity but not in the Entity classes. In this case, "Update Model from Database" option also doesn't work quiet well.

Solution:
1) Goto the Properties Window of the column that has the issue. (On the Entity Diagram Design View, right click -> Mapping Details -> Select the table with the issue column -> In Mapping Details window select the column and press F4 for its properties). In the properties window change Nullable property value from (None) to False.
2) If the Nullable property is already False, then the best option is to remove the table from the Entity Model. Then selection option "Update Model from Database". Select the removed table and click on Finish. Now the issue should be fixed.

No comments:

Post a Comment