Reputation: 10755
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
Upvotes: 8
Views: 14290
Reputation: 135
Just another cause of this that we came across: say we have two developers, A and B.
Dev B then changes the model in some way and updates it from the database, VS sees that mytable.newcol doesn't exist so it becomes unlinked.
Dev B realises their error and publishes the database changes.
Dev B then updates the model from the database again. Now VS sees the mytable.newcol column in the database and creates a mytable.newcol1 (note the suffix) that is linked to the database column, since it already had an unlinked newcol in the model.
For Dev B, VS then complains that mytable.newcol isn't mapped and fails.
Solution - to fix, remove mytable.newcol from the model, rename mytable.newcol1 to newcol... or revert to where you were and remember to publish the database before updating the model!
Hope this helps someone.
Upvotes: 0
Reputation: 24005
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.
Upvotes: 2
Reputation: 364249
The error means that your table imported to the model contains additional column ItemPrice
which is not mapped to your entity.
Upvotes: 9