When I try to add my Entity Model, I get Error 3007.

entity-framework entity-relationship


I am getting an error 3007 when I add my entity model to my solution.

I found these links:

Good explination

Short answer

About this error:

Error 1 Error 3007: Problem in Mapping Fragments starting at lines 89, 94: Non-Primary-Key column(s) [Person_ID] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified.

Their Answer: I agree with their conclusion that by simply deleting the Scalar Property Person_ID and leave the Navigation Property my problem is fixed. However this is not very scalable since I am dynamically building my database and my entity is updated very often. I dont want to have to go through and clean up my entity every time I update it.

My Question: Is there a way to fix the error by correcting the way EF builds the entity? Or is there a way to remove the Scalar Property through code? Perhaps there is even a few options that I am overlooking.

9/2/2009 7:29:03 PM

Accepted Answer

My experience with EF v1 is similar to yours. When the EDM is generated incorrectly and you can't work around the issue, you have to manually edit the EDM. EF v.Next (Entity Framework v4 I believe) will support "Code Only" Entity Data Models, and the EDM designer is supposed to be much better. One or the other improvement should make our lives easier. Until then...

9/3/2009 1:23:22 PM

Popular Answer

Try to remove foreign property column from Entity set using entity model design it will solve your problem

For example

We have two tables one is customer and other one is order, using entity model design we added association between customers and orders when we do this Ado.net entity framework i will add navigation properties to both below tables.

Like Customer.Orders - Here order is list Order.Customer

One - Many relation.

So we need to remove property from with name CustomerId[Foreign key column] from Order entity set.

For reference:


Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow