Entity Framework 核心 2.2 中的预加载

Eager Loading in Entity Framework Core 2.2

Entity Framework Core 2.2 是否移除了 Eager Loading? include方法不会出现在Visual Studio intellisense中,我手动写的时候报错:"it does not contain a definition for 'Include' and no accessible extensions..."

示例

School school = _context.Students.Include... 

我的演示是使用简单的 ASP Core 2.2 制作的。 Web应用程序。没有太多改变。该项目使用此包:

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.0" />
  </ItemGroup>

Have Entity Framework Core 2.2 removed Eager Loading?

不,还是exists

The include method won't appear in Visual Studio intellisense, and when I write it manually it gives an error: "it does not contain a definition for 'Include' and no accessible extensions..."

您的 code 中似乎缺少以下 using 语句:

using Microsoft.EntityFrameworkCore;