Entity Framework 4 mapping fragment error when adding new entity scalar

Jason Morse picture Jason Morse · Jun 9, 2010 · Viewed 62.1k times · Source

I have an Entity Framework 4 model-first design. I create a first draft of my model in the designer and all was well. I compiled, generated database, etc.

Later on I tried to add a string scalar (Nullable = true) to one of my existing entities and I keep getting this type of error when I compile:

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]

I keep having to manually open the EDMX file and correct the XML whenever I add scalars.

Ideas on what's going on?

Answer

Jason Morse picture Jason Morse · Jun 10, 2010

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.