Eager Loading in Entity Framework Core 2.2

asp.net-core eager-loading entity-framework-core

Question

Have Entity Framework Core 2.2 removed Eager Loading? 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..."

Example

School school = _context.Students.Include... 

My demo is made with a simple ASP Core 2.2. Web Application. Not much have been changed. The project use this packages:

<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
12/24/2018 4:24:05 AM

Accepted Answer

Have Entity Framework Core 2.2 removed Eager Loading?

No, it still 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..."

Looks like you are missing the following using statement in your code:

using Microsoft.EntityFrameworkCore;
2
12/24/2018 12:34:03 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow