本文介绍了为什么会出现UserStore和在Rolestore之间实现差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这没有问题:

public class ApplicationUserStore : UserStore<ApplicationUser, ApplicationRole, string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>
{
    public ApplicationUserStore(MyAppDb context)
        : base(context)
    {
    }
}

虽然这个:

public class ApplicationRoleStore : RoleStore<ApplicationRole, string, ApplicationUserRole>
{
    public ApplicationRoleStore(MyAppDb context)
        : base(context)
    {
    }
}

...产生以下编译时错误:

...produces the following compile time error:

类型MyApp.Models.ApplicationRole'不能用作类型
  参数'TRole在泛型类型或方法
  Microsoft.AspNet.Identity.EntityFramework.RoleStore。有
  从没有隐式引用转换MyApp.Models.ApplicationRole
  以Microsoft.AspNet.Identity.EntityFramework.IdentityRole。

这个问题来自试图在这里解决这一问题:
Why是UserManager.CreateIdentityAsync()寻找IdentityRole,以及如何解决?

This issue came from trying to solve the issue here:Why is UserManager.CreateIdentityAsync() looking for IdentityRole and how to fix?

我真的不关心,只要我解决这个问题我解决这个哪种方式。谢谢你。

I don't really care which way I solve this as long as I solve it. Thanks.

推荐答案

这里没有问题,和没有实现差异。它必须是一个嗝。的Visual Studio 2013的重启并没有解决编译时错误。然而,重新启动计算机一样。 这里没有问题 - 待着

There is no issue here and no implementation difference. It must have been a hiccup. A restart of Visual Studio 2013 did not resolve the compile-time error. However, a restart of the computer did. No issue here--move along.

这篇关于为什么会出现UserStore和在Rolestore之间实现差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 22:12