且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取在ASP.NET MVC5识别系统中所有的角色名

更新时间:2023-02-26 08:40:28

我发现,您可以通过 IdentityStore 的DbContext / code>实例,并使用众所周知的方法。设置< T>()

I've found that you can use the DbContext via the IdentityStore instance and use the well-known method .Set<T>().

这对我的作品:

var identityStore = new IdentityStore();
foreach (var role in identityStore.DbContext.Set<Role>())
{
    Debug.WriteLine(role.Name);
}