c# - 带有 Identity 2 和 EntityFramework 6 的 ASP.NET Core MVC(甲骨文)

标签 c# oracle entity-framework-6 asp.net-core-mvc asp.net-identity-2

我正在使用 ASP.NET Core MVCEntityFramework 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.AspNetCoreMicrosoft.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/

相关文章:

c# - 好的类设计实例

c# - MailKit - 如何获取每个附件的大小

c# - 以编程方式访问 Excel 自定义文档属性

c# - 在 Entity Framework 中使用拦截器时如何禁用它们

c# - 我应该如何存储用户指定的一组文件?

sql - 填补查询返回值的空白

mysql - 如何修复必须在存储过程中声明的标识符?

sql - 除了参数之外,SQL 中的 @ 符号是什么?

c# - 如何使用 Entity Framework Code First 定义一对一的自引用

entity-framework-6 - 如何在身份用户和我的员工表之间创建一对一关系