假设我有一个实体 Foo,它包含另一个实体 Bar 的列表。Bar 应该直接引用 Foo 吗?IE..
public class Foo
{
public int Id {get; set;}
public IList<Bar> Bars {get; set;}
}
public class Bar
{
public int Id {get; set;}
public Foo parentFoo {get; set; //this will be set to an the Foo entity on creation
}
还是我只是在我的 Bar 类中省略了对 Foo 的引用?
我倾向于忽略该参考,但想知道这里的正确方法是什么?