Correct association mapping in Entity Framework
Posted
by
Matt Thrower
on Stack Overflow
See other posts from Stack Overflow
or by Matt Thrower
Published on 2011-01-11T16:11:12Z
Indexed on
2011/01/11
16:53 UTC
Read the original article
Hit count: 219
.NET
|entity-framework
Hi,
Trying to change two relationships in our entity framework from many-to-one to many-to-many relationships. So I tried the obvious thing: clicked on each association on the diagram, changed the appropriate end of the association accordingly and then changed the name of the navigation property to a plural to reflect the change.
This lead to the following build error, or one each for the two changes I've made:
Error 3002: Problem in mapping fragments starting at line 1761:Potential runtime violation of table CustomerServices's keys (CustomerServices.Id): Columns (CustomerServices.Id) are mapped to EntitySet CompiledDatabaseCustomerService's properties (CompiledDatabaseCustomerService.CustomerService.Id) on the conceptual side but they do not form the EntitySet's key properties (CompiledDatabaseCustomerService.CompiledDatabase.Id, CompiledDatabaseCustomerService.CustomerService.Id)
I'm not entirely sure why this is happening, so unsurprisngly I haven't had much luck fixing it. I've tried fiddling with the mapping details and adding referential constraints to no avail. Anyone point me in the right direction?
cheers, Matt
© Stack Overflow or respective owner