Why is there no SingleOrDefaultAsync for IQueryables?

Try:

Add the following statement into the module you are working on:

// using Microsoft.EntityFrameworkCore;

Then using .NET CLI,

dotnet add package Microsoft.EntityFrameworkCore.Tools --version <version-you-want> // if ommited the latest will be installed
dotnet restore
dotnet build

using PM:

dotnet add package Microsoft.EntityFrameworkCore.Tools --version <version-you-want> // if omitted the latest will be installed
dotnet restore
dotnet build

or Package Reference:

Add on your project .csproj file

 <ItemGroup>
       <PackageReference Include="Microsoft.EntityFrameworkCore" Version="<verion>" />
 </ItemGroup>

// in the CLI
dotnet restore

Make sure you have added System.Data.Entity namespace to your usings. This is an extension method, and it will not be available until you add appropriate namespace.


I fixed it by adding using Microsoft.EntityFrameworkCore;