我知道这可能是一个很钝的问题,但这样做的实体代表一个查找表需要导航性能?适当的导航属性使用
例如
public class State
{
public int StateId { get; set; }
public string StateName { get; set; }
public string StateAbbr { get; set; }
public virtual ICollection<AccreditingAgency> AccreditingAgencies { get; set; }
}
public class AccreditingAgency
{
public int AccreditingAgencyId { get; set; }
public string AgencyName { get; set; }
public string AgencyAddress { get; set; }
public string AgencyCity { get; set; }
public int StateId { get; set; }
public string AgencyZipCode { get; set; }
public string AgencyWebsite { get; set; }
public virtual State State { get; set; }
}
此外,在上面的例子中,应我甚至有AccreditingAgency国家导航属性?
事实上,当应该使用的导航属性?
感谢您的任何澄清。
任何Json/XML串行器都会窒息的循环引用结构的典型示例。 – 2012-07-12 19:53:53
那么,我假设没有呢?只是很好奇,因为Model First方法将这作为每个实体的默认设置。我找到的教程没有真正解释导航属性。 – Erik 2012-07-12 19:59:38