Entity Framework 4 and 0:1, 0:1 relationships

Posted by Eric J. on Stack Overflow See other posts from Stack Overflow or by Eric J.
Published on 2010-06-02T19:09:56Z Indexed on 2010/06/02 19:14 UTC
Read the original article Hit count: 152

Filed under:

I'm using the Model First approach with EF 4 and hit a snag with two tables, Participant (singular because pre-existing from another app) and ActiveParticipants.

A Participant may or may not be associated with exactly one ActiveParticipant and vice versa.

When I create an association, everything seems to go well on the surface, but then I get a runtime error complaining that Participant does not contain the column ActiveParticipant_Id. It does contain a column ActiveParticipantId (no underscore).

When I view the diagram as XML, there's a line like this:

<Property Name="ActiveParticipant_Id" Type="uniqueidentifier" Nullable="true" />

Why is it adding an underscore? Is there anything special I need to do for 0:1, 0:1 relationships?

© Stack Overflow or respective owner

Related posts about entity-framework-4