locked
0..1:* relationship RRS feed

  • Question

  •  Relationship(c => c.Department).IsRequired()
                    .FromProperty(d => d.Courses).HasConstraint(
                    (c, d) => c.DepartmentID == d.DepartmentID);

     Relationship(c => c.Department)
                    .FromProperty(d => d.Courses).HasConstraint(
                    (c, d) => c.DepartmentID == d.DepartmentID);

     Relationship(c => c.Department)
                    .HasConstraint(
                    (c, d) => c.DepartmentID == d.DepartmentID);

    All have the same result : 1...* relationship

    I want to have 0...* relationship,and read DepartmentID directly ,how can i set

    DepartmentID =0 (NULL)

    ParentId=0 (NULL)
    Wednesday, March 17, 2010 2:34 AM

Answers

  • Is DepartmentID nullable? If it is not, then the relationship must be 1:*, not 0..1:*.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, April 8, 2010 10:15 PM
    Moderator