我有非常基本的代码:
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。这是为什么?