没有从ApplicationDbContext到Microsoft.EntityFrameworkCore.DbContext的隐式引用转换。 [英] There is no implicit reference conversion from ApplicationDbContext to Microsoft.EntityFrameworkCore.DbContext

查看:370
本文介绍了没有从ApplicationDbContext到Microsoft.EntityFrameworkCore.DbContext的隐式引用转换。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在遵循



异常消息:


类型'WebExtractorPortalCore.Context.ApplicationDbContext'不能将
用作通用类型或方法$ b $中的类型参数'TContext' b'DbContextOptions'。从
'WebExtractorPortalCore.Context.ApplicationDbContext'到
'Microsoft.EntityFrameworkCore.DbContext'没有隐式引用转换。



解决方案

要获得一个完美的答案,我需要更多信息,但要形成错误图像,您似乎正在混用ASP.Net软件包和ASP.NETCore软件包。



您已引用 Microsoft.EntityFrameworkCore ,它是.net核心程序包,但随后引用了 Microsoft.AspNet.Identity.EntityFramework 是.net(核心)程序包。



删除后面的程序包并引用 Microsoft.AspNetCore.Identity.EntityFrameworkCore 代替,它应该可以工作


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'.

解决方案

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

这篇关于没有从ApplicationDbContext到Microsoft.EntityFrameworkCore.DbContext的隐式引用转换。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆