相关疑难解决方法(0)

导航属性应该是虚拟的 - 在ef核心中不需要?

我记得在EF 导航属性应该是虚拟的:

public class Blog 
{  
    public int BlogId { get; set; }  
    public string Name { get; set; }  
    public string Url { get; set; }  
    public string Tags { get; set; }  

    public virtual ICollection<Post> Posts { get; set; }  
}
Run Code Online (Sandbox Code Playgroud)

但我看看EF Core并不认为它是虚拟的:

public class Student
    {
        public int ID { get; set; }
        public string LastName { get; set; }
        public string FirstMidName { get; set; }
        public DateTime EnrollmentDate { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# virtual entity-framework navigation-properties entity-framework-core

43
推荐指数
3
解决办法
2万
查看次数