添加 IdentityDbContext 的问题

Issue adding IdentityDbContext

我正在使用 Asp Net core 3 并尝试添加身份核心。当我添加 IdentityDbContext 时它会出错,如果我将 IdentityDbContext 更改为 DbContext 错误就消失了。同样的问题是当我尝试使用 IdentityDbContext 添加 SQL sever 但使用 DbContext 时没有错误。 我收到以下错误 "There is no implicit reference conversion from IdentityDbContext to Microsoft.EntityFrameworkCore.DbContext" . 我添加了以下 NuGet 包 Microsoft.AspNetCore.Identity.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.Sqlserver。请帮忙。

Put your cursor on IdentityDbContext and press F12, ...

I navigated to IdentityDbContext class, its empty nothing in that class.

这意味着您不小心通过 Intellisense 创建了 class。查看它的位置:在您的项目中,而不是库中。

在您的项目中找到 class 并将其删除。然后修复 Startup class 需要的任何 references/usings。