我正在尝试使用默认的 MVC6 模板升级 Asp.Net Identity 2“自定义存储提供程序”以与 Visual Studio 2015 中的 Identity 3 beta 4 一起使用。
我在学习如何使用 ASP5 中间件注册 Asp.Net Identity 3 自定义存储提供程序时遇到了困难。
目前我做了以下,但不确定它是否正确:
services.AddIdentity()
.AddRoleStore>()
.AddUserStore>()
.AddDefaultTokenProviders();
我不确定如何注册数据库上下文?
在我的项目中被称为 MySQLDatabase.cs
我找不到任何文件。
注册 Identity.EntityFramework 中间件似乎与自定义存储提供程序不同。
运行默认 MVC6 模板并单击“注册”按钮时收到以下错误:
“InvalidOperationException:在尝试激活 'Bondii.Identity.MySQL.UserStore`1[Bondii.Identity.MySQL.IdentityUser]' 时,无法解析类型 'Bondii.Identity.MySQL.MySQLDatabase' 的服务。”
我的代码包括完整项目:
GitHub仓库看我的代码是: https ://github.com/simonpbond/bondii.identity.mysql
原始的“基于 Identity 2 的自定义存储提供程序教程 - 我正在尝试升级到 Identity 3: http ://www.asp.net/identity/overview/extensibility/implementing-a-custom-mysql-aspnet-identity-storage -提供者。
原始示例代码: https ://aspnet.codeplex.com/SourceControl/latest#Samples/Identity/AspNet.Identity.MySQL/