Entity Framework "Problem in Mapping Fragments" Error

If you add an entity to the Entity Data Model, then later add another entity that is related in the database to the first entity, Visual Studio will give you a “Problem in Mapping Fragments” error.

For example, if you add a Northwind database Orders table using the EDM Update Wizard, it produces an entity that looks has an EmployeeID property that corresponds to the EmployeeID foreign key column of the Orders table.

Next, if you add a Northwind database Employees table using the EDM Update Wizard, an Employees property gets added to the bottom of the Orders entity under Navigation Properties and a relationship between the Orders and Employees entities is shown on the diagram. However, there is still an EmployeeID property on the Orders entity. This is what causes the “Problem in Mapping Fragments” error.

In order to get around this error, you can simply remove the redundant EmployeeID property from the Orders entity by right-clicking it in the designer and selecting Delete from the shortcut menu.

Kevin McNeish
Microsoft .NET MVP
Chief Architect, MM .NET Application Framework