Unidirectional One-to-Many Associations in Entity Framework 4?

Posted by Eric J. on Stack Overflow See other posts from Stack Overflow or by Eric J.
Published on 2010-05-30T07:21:34Z Indexed on 2010/05/30 7:32 UTC
Read the original article Hit count: 322

Does EF 4 support unidirectional one-to-many associations, as in:

public class Parent
{
  public int Id { get; set; }
  public string Something { get; set; }
  public List<Child> AllMyChildren { get; set; }
}

public class Child
{
  public int Id { get; set; }
  public string Anotherthing { get; set; }
  // I don't want a back-reference to the Parent!
  // public int ParentId { get; set; }
}

When I try to compile my project with an association between Parent and Child where End2 Navigation is blank (because I unchecked the End2 Navigation Property checkbox in the Add Association dialog), I get

Error 2027: No mapping specified for the following EntitySet/AssociationSet - Child.

© Stack Overflow or respective owner

Related posts about associations

Related posts about entity-framework-4