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

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.

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.

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.

Thursday, September 13, 2012

SQL Server "Saving changes is not permitted" Management Studio (SSMS)

"Saving changes is not permitted" - Error from SSMS when saving Table in Design View

"Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created."

This error happens from SQL Server Management Studio, when trying to save (edit/update) Table structure in Design View. Actually this is a SQL Server Management Studio (SSMS).

Tools -> Options -> Designers-> Uncheck "Prevent saving changes that require table re-creation"