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,525 other followers

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 said

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

  2. Rafa said

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

    • 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 said

    Great jeroen… thanks a lot. This works fine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: