ソースを表示:ASPNETコアは、スタートアップコードを以下に配置されたクラスを開始
、同様に公式ドキュメントを説明しているように https://docs.microsoft.com/zh-cn/aspnet/core/security/authentication/identity?view=aspnetcore-3.1&tabs=visual-studio
定義された拡張メソッド:AddIdentity <TUSER、TRole>(IServiceCollection) 、ユーザーができるだけで AddIdentityCore <TUSER>(IServiceCollection) 、プラス役割。
或 AddIdentity <TUSER、TRole>(IServiceCollection、アクション<IdentityOptions>) 或 AddIdentityCore <TUSER>(IServiceCollection、アクション<IdentityOptions>)
services.AddIdentity <ApplicationUser、IdentityRole <GUID >>()
.AddRoles <IdentityRole <GUID >>()
.AddEntityFrameworkStores <ApplicationDbContext>()
.AddDefaultTokenProviders();