The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,858 other subscribers

Entity Framework 4 “Error 3004: Problem in mapping fragments starting at line” means you must generate your DB from your model first (Stack Overflow)

Posted by jpluimers on 2011/04/05

Entity Framework 4 is nice, but has very confusing  error messages.

Maybe it is just me, but getting a feel for what each error message means, and how to cure the underlying mistake(s) is time consuming.

For instance, it took me quite a while to find out why this error occurred during a project build:

Error 3004: Problem in mapping fragments starting at line 569: No mapping specified for properties MyEntity.MyValue in Set MyEntities. An Entity with Key (PK) will not round-trip when: Entity is type [MyEntities.MyEntity]

The solution was simple, I had forgotten to manually perform the “Generate Database from Model…” step before building my solution and was glad I found it in this Stack Overflow answer:

Have since discovered that after I add/change/delete properties on my entities I must “Generate Database from Model” before I compile otherwise I get 3004 mapping errors.

Note that this generation is always a manual step; I haven’t found a way to automate that (if you have found a way: please add a comment below).

–jeroen

via: .net – Entity Framework 4 mapping fragment error when adding new entity scalar – Stack Overflow.

5 Responses to “Entity Framework 4 “Error 3004: Problem in mapping fragments starting at line” means you must generate your DB from your model first (Stack Overflow)”

  1. John Cena's avatar

    John Cena said

    Love you my dear.. It works & you save my lots of time for wasting.

  2. Rafa's avatar

    Rafa said

    how I can “Generate database from the model”? thanks

    • jpluimers's avatar

      jpluimers said

      See the updated “Generate database from the model” link in the post. That leads you to a some great examples on how to do this.

  3. Sugeesan's avatar

    Sugeesan said

    Great jeroen… thanks a lot. This works fine

Leave a reply to Rafa Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.