.net – Entity Framework 4 mapping fragment error when adding new entity scalar

entity-frameworkentity-framework-4net

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?

Best 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.