I am new to EF core and I\'m trying to get it to work with my ASP.NET Core project.
I get the above error in my startup.cs
when trying configure the
Easy way to fix this issue
Error message:
Solution:
to install "microsoft.entityframeworkcore.sqlserver" with NuGet
Fixed :
PS: make sure you have using EF on the content "using Microsoft.EntityFrameworkCore;"
Project is works in DotNET Core 3.1+ or higher(future)
Add this package:
Microsoft.EntityFrameworkCore.Tools
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8">
Wow so many answers yet none mentioned this Microsoft.EntityFrameworkCore.InMemory package!
Add the reference to this package:
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.2" />
and you should be good to go.
For asp.net core version 2.1 make sure to add the following package to fix the problem. (At least this fix the issue using SQLite)
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
dotnet add package Microsoft.EntityFrameworkCore.Design
Here is the reference of the documentation using SQLite with entity framework core. https://docs.microsoft.com/en-us/ef/core/get-started/netcore/new-db-sqlite
Currently working with Entity Framework Core 3.1.3. None of the above solutions fixed my issue.
However, installing the package Microsoft.EntityFrameworkCore.Proxies on my project fixed the issue. Now I can access the UseLazyLoadingProxies() method call when setting my DBContext options.
Hope this helps someone. See the following article:
Lazy Loading in EF Core
your solution works great.
When I saw this video till 17 Minute: https://www.youtube.com/watch?v=fom80TujpYQ I was facing a problem here:
services.AddDbContext<PaymentDetailContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DevConnection")));
UseSqlServer not recognizes so I did this Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.1.5
& using Microsoft.EntityFrameworkCore;
Then my problem is solved. About me: basically I am a purely PHP programmer since beginning and today only I started .net coding, thanks for good community in .net