Why EF navigation property return null?

后端 未结 5 646
执笔经年
执笔经年 2020-12-17 16:12

I have two model 1)

public class Indicator
{
    public long ID { get; set; }
    public string Name { get; set; }
    public int MaxPoint { get; set; }
             


        
5条回答
  •  长情又很酷
    2020-12-17 16:58

    Check this out: Navigation Property With Code First . It mentions about why navigation property is null and the solutions of it.

    By default, navigation properties are null, they are not loaded by default. For loading navigation property, we use “include” method of IQuearable and this type of loading is called Eager loading.

    Eager loading: It is a process by which a query for one type of entity loads the related entities as a part of query and it is achieved by “include” method of IQueryable.

提交回复
热议问题