C# Asp.Net Identity 2.0中的角色管理器似乎不支持GUID
到目前为止,我在将所有类型转换为使用Guid时没有遇到任何问题(例如: 显然,C# Asp.Net Identity 2.0中的角色管理器似乎不支持GUID,c#,asp.net-identity-2,C#,Asp.net Identity 2,到目前为止,我在将所有类型转换为使用Guid时没有遇到任何问题(例如: 显然,TKey是通用的,因此它允许Guid 接下来是角色管理器: public class RoleManager : RoleManager<Role> { } 仅当角色的键为string时才显示有效。这是一个bug还是我遗漏了什么?好的,这很奇怪 // Assembly Microsoft.AspNet.Identity.Core.dll, v2.0.0.0 namespace Microsoft.AspN
TKey
是通用的,因此它允许Guid
接下来是角色管理器:
public class RoleManager : RoleManager<Role>
{
}
仅当角色的键为string
时才显示有效。这是一个bug还是我遗漏了什么?好的,这很奇怪
// Assembly Microsoft.AspNet.Identity.Core.dll, v2.0.0.0
namespace Microsoft.AspNet.Identity
{
public class RoleManager<TRole> : RoleManager<TRole, string>
where TRole : class, Microsoft.AspNet.Identity.IRole<string>
{
// Summary:
// Constructor
//
// Parameters:
// store:
public RoleManager(IRoleStore<TRole, string> store);
}
}
第一个角色管理器可能是一些遗留代码(string
用于Asp.Net Identity 1)。从第二个rolemager
中派生出来似乎是一种方法:
public class RoleManager : RoleManager<Role, Guid> { ... }
公共类RoleManager:RoleManager{…}
public class RoleManager<TRole> : RoleManager<TRole, string>
where TRole : class, Microsoft.AspNet.Identity.IRole<string>
{
}
// Assembly Microsoft.AspNet.Identity.Core.dll, v2.0.0.0
namespace Microsoft.AspNet.Identity
{
public class RoleManager<TRole> : RoleManager<TRole, string>
where TRole : class, Microsoft.AspNet.Identity.IRole<string>
{
// Summary:
// Constructor
//
// Parameters:
// store:
public RoleManager(IRoleStore<TRole, string> store);
}
}
// Assembly Microsoft.AspNet.Identity.Core.dll, v2.0.0.0
namespace Microsoft.AspNet.Identity
{
public class RoleManager<TRole, TKey> : IDisposable
where TRole : class, global::Microsoft.AspNet.Identity.IRole<TKey>
where TKey : global::System.IEquatable<TKey>
{
...
}
}
public class RoleManager : RoleManager<Role, Guid> { ... }