Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Asp.Net Identity 2.0中的角色管理器似乎不支持GUID_C#_Asp.net Identity 2 - Fatal编程技术网

C# Asp.Net Identity 2.0中的角色管理器似乎不支持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

到目前为止,我在将所有类型转换为使用Guid时没有遇到任何问题(例如:

显然,
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> { ... }