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
www.oakleafsd.com


 

One thought on “Entity Framework "Problem in Mapping Fragments" Error”

  1. This tip is just what I was looking for. Had this problem exactly in an EDM after adding a new Entity Type.

    Greg Hollywood

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>