EF Core,加载导航属性而不包含Include()或Load()

时间:2017-03-16 08:17:26

标签: c# ef-code-first entity-framework-core

我有非常基本的代码:

using Microsoft.EntityFrameworkCore;
using System.Linq;

var fooEntry = this.context.FooEntries.Single(r => r.Id == fooId);

public class FooEntity
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; private set; }

    public string Title { get; set; }

    [ForeignKey("NavigationPropertyId")]
    public SomeClass NavigationProperty { get; set; }

    public int NavigationPropertyId { get; set; }

}

在EF Core Lazy Loading中未实现。只有在我使用Eager Loading或Explicit Loading时才应加载NavigationProperty。但就我而言,它会自动加载NavigationProperty。这是为什么?

0 个答案:

没有答案