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
I had same issue but problem went off after going back and fixing DbContext
incorrect syntax issue such as it should have been ExampleDbContextClass: DbContext
whereas I had missed DbContext
part in Context Class where you define your DbSet
. Also, I verified following dependencies are needed in order to achieve connection to SqlServer.
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
Also verify that Version you install is less than your project's current version to be on safe side. Such as if your project is using 3.1 do not try to use newer one which would be for example 3.1.9. I had issue with that too.
Install package, EntityFrameworkCore.SqlServer:
PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.1.3
Nuget: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer/
I also had the same problem. I added the following. It works for me
Microsoft.EntityFrameworkCore.SqlServer
For anyone still having this problem: Use NuGet to install: Microsoft.EntityFrameworkCore.Proxies
This problem is related to the use of Castle Proxy with EFCore.
The Package is missing. Open Package Manager Console and execute the code below:
Install-Package Microsoft.EntityFrameworkCore.SqlServer
I got around this by simply:
Add SqlServerDbContextOptionsExtensions
to the class in question
Resolve SqlServerDbContextOptionsExtensions
This fixes the issue, must be missing some reference by default.