2 つのエンティティPost
とがありPhoto
ます。comment
どちらもエンティティのコレクションを持っています。
mapping
以下に書かれていることを避けるためにとにかくありますか(エンティティの各親に対して1つのプロパティを定義する必要があります)?Comment
public class Post
{
public string Title {get; set;}
public ICollection<Comment> Comments{get; set; }
}
public class Photo
{
public string Path{get;set;}
public ICollection<Comment> Comments{get; set; }
}
public class Comment
{
public int? PostId{get;set;}
public Virtual Post Post{get;set;}
public int? PhotoId{get;set;}
public Virtual Photo Photo{get;set;}
}