ナビゲーション プロパティを使用しようとしていますが、使用するとエラーが発生します
値を null にすることはできません。
People コレクションが NULL であることは理解できますが、なぜ NULL なのですか?
私が実際にやろうとしているのは、RequestorPersonID (最後のコード スニペットの最後の行) によってリクエスターの名前を選択することです。
public abstract class Person
{
    [Key]     
    public int PersonID { get; set; }         
    public string FirstName { get; set; }      
} 
public class Employee : Person
{
    public string Department { get; set; }
}
public class FrDetail
{
    [Key]
    public int FrID { get; set; }      
    public int RequestorPersonID { get; set; }
    virtual public IList<Person> People { get; set; }
}
public class EFDbContext : DbContext
{      
       public DbSet<Person> People { get; set; }
       public DbSet<Employee> Employees { get; set; }
       public DbSet<FrDetail> FrDetails { get; set; }    
} 
public ViewResult List()
{
    EFDbContext context = new EFDbContext();
    IQueryable<FrDetail> frDetails = context.FrDetails.Include(x => x.People);
    return View(frDetails);
}
//The view
@model IQueryable<FrDetail>   
@foreach (var p in Model)
    Html.RenderPartial("FunctionRequestSummary", p);
}
//Partial View FunctionRequestSummary
@model FrDetail
@Model.People.Count()//IT'S ALWAYS ZERO
//@Model.People//NULL
@Model.People.Where(x=>x.PersonID==Model.RequestorPersonID).FirstOrDefault().FirstName
問題は、カウントが常に 0 である最後の行にあります。切り替えてみました
ProxyCreationEnabled = false; および LazyLoadingEnabled = false;
これも役に立ちませんでした。何か不足していますか?