Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 3004, mapping error with EF

Ok since my of my issues have been resolved,I was flying through the code, until now: I've now run into one I cant even find anything on Google for it. Here's the text of the error:

Error 3004: Problem in mapping

fragments starting at line 937:No mapping specified for properties StoreItem.ItemPrice in Set StoreItems. An Entity with Key (PK) will not round-trip when: Entity is type [psychoco_GodsCreationTaxidermyModel.StoreItem] F:\Projects\GodsCreationTaxidermySVN\GodsCreationTaxidermy.Data\GCTEntities.edmx 938 945 GodsCreationTaxidermy.Data

Of you need any code samples let me know

like image 203
PsychoCoder Avatar asked May 09 '11 01:05

PsychoCoder


2 Answers

The error means that your table imported to the model contains additional column ItemPrice which is not mapped to your entity.

like image 146
Ladislav Mrnka Avatar answered Nov 05 '22 06:11

Ladislav Mrnka


I ran into the same error, using the database first approach. The cause was that when I added an association through the designer, EF decided to add a synthetic field to my principal, based on whatever key relationship I had defined. If you are doing database first, check if ItemPrice on StoreItem is a real database field, or if EF just decided to generate it for you.

like image 42
stevebot Avatar answered Nov 05 '22 07:11

stevebot