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

淺唱寂寞╮ 提交于 2020-01-16 18:05:26

问题


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:

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:


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



来源:https://stackoverflow.com/questions/52604618/there-is-no-implicit-reference-conversion-from-applicationdbcontext-to-microsoft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!