How does one setup the mapping in fluent for this type?
public class Topic
{
public int Id { get; set; }
public string Title { get; set; }
public virtual ICollection<Topic> Children { get; set; }
public int ParentId { get; set; }
public Topic Parent { get; set; }
public virtual ICollection<Topic> Related { get; set; }
}
I’m assuming that ParentId is not required as not every topic will have a parent.
then the mapping would look something similar to
And plugin on model binding:
I’d also recommend getting your hands on the EF Power Tools CTP. It’s very helpful in learning and understanding how to create fluent configs.
Hope that helps.