实体框架核心2.2中的急切加载

时间:2018-12-23 18:38:03

标签: asp.net-core entity-framework-core eager-loading

是否已删除Entity Framework Core 2.2急切加载?包含方法不会出现在Visual Studio intellisense中,当我手动编写它时,会出现错误:“它不包含'包含'的定义,并且没有可访问的扩展...”

示例

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>

1 个答案:

答案 0 :(得分:1)

  

是否已删除Entity Framework Core 2.2急切加载?

不,它仍然exists

  

include方法不会出现在Visual Studio intellisense中,当我手动编写它时,会出现错误:“它不包含'include'的定义,也没有可访问的扩展...”

好像您在code中缺少以下using语句:

using Microsoft.EntityFrameworkCore;
相关问题