我正在使用 ASP.NET Core MVC
和 EntityFramework 6
(不是 EF Core,因为 oracle 还没有为 Oracle 支持提供 EF7)
我无法使用 AddEntityFrameworkStores,因为 ApplicationDbContext 必须是 Microsoft.EntityFrameworkCore.DbContext
我不必在 Identity 中使用 EntityFramework,这是我使用 Asp.NET Core Identity with Oracle 的其他方式吗。
public void ConfigureServices(IServiceCollection services)
{
var a=services.AddIdentity<ApplicationUser, Microsoft.AspNet.Identity.CoreCompat.IdentityRole>();
a.AddEntityFrameworkStores<ApplicationDbContext>().AddDefaultTokenProviders();//Error Compile
}
错误 CS0311 类型“x.Models.ApplicationDbContext”不能用作泛型类型或方法“IdentityEntityFrameworkBuilderExtensions.AddEntityFrameworkStores(IdentityBuilder)”中的类型参数“TContext”。没有从“x.Models.ApplicationDbContext”到“Microsoft.EntityFrameworkCore.DbContext”的隐式引用转换。 MPWebApplicationCore..NET Framework 4.5.2
最佳答案
我找到了一个没有 Entity Framework 的 ASP.NET Core Identity 的例子
对于 asp.net 核心
将依赖项从 Microsoft.AspNet
更改为 Microsoft.AspNetCore
将 Microsoft.AspNet.Identity
更改为 Microsoft.AspNetCore.Identity
https://github.com/MatthewKing/IdentityWithoutEF/tree/58631cda6e1a719ea513e49ba65c152d8cf78ec1
关于c# - 带有 Identity 2 和 EntityFramework 6 的 ASP.NET Core MVC(甲骨文),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38987268/