I\'m having issues getting an optional one-to-many relationship to work.
My model is:
public class Person
{
public int Identifier { get; set; }
Also try this:
public class Person
{
public int Identifier { get; set; }
public int DepartmentIdentifier {get; set;}
public virtual Department Department { get; set; }
}
public class Department
{
public int Identifier { get; set; }
public virtual IList Members { get; set; }
}
EF Person config using Fluent API:
this.HasRequired(p => p.Department).WithMany(d => d.Members).HasForeignKey(p =>
p.DepartmentIdentifier);
this.Property(p => p.DepartmentIdentifier).IsRequired();