There is no implicit reference conversion from ApplicationDbContext to Microsoft.EntityFrameworkCore.DbContext

asp.net-web-api c# entity-framework-core

Question

While following the tutorial, I am getting an error when DbContextOptions<ApplicationDbContext> which is ApplicationDbContext inherit to IdentityDbContext but when I tried to inherit DbContext it works fine.

Error Screen Shot:
Error Screen Shot

Exception message:

The type 'WebExtractorPortalCore.Context.ApplicationDbContext' cannot be used as type parameter 'TContext' in the generic type or method 'DbContextOptions'. There is no implicit reference conversion from 'WebExtractorPortalCore.Context.ApplicationDbContext' to 'Microsoft.EntityFrameworkCore.DbContext'.

1
0
10/3/2018 12:40:19 AM

Accepted Answer

For a perfect answer I need more information but form the error image you seem to be mixing ASP.Net packages and ASP.NETCore packages.

You have referenced Microsoft.EntityFrameworkCore which is a .net core package but then referenced Microsoft.AspNet.Identity.EntityFramework which is a .net (not core) package.

Remove the later package and reference Microsoft.AspNetCore.Identity.EntityFrameworkCore instead and it should work

4
10/2/2018 9:35:08 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