为什么会出现UserStore和在Rolestore之间实现差异? [英] Why is there an implementation difference between the UserStore and the RoleStore?

查看:395
本文介绍了为什么会出现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。

The type 'MyApp.Models.ApplicationRole' cannot be used as a type parameter 'TRole' in the generic type or method 'Microsoft.AspNet.Identity.EntityFramework.RoleStore'. There is no implicit reference conversion from 'MyApp.Models.ApplicationRole' to 'Microsoft.AspNet.Identity.EntityFramework.IdentityRole'.

这个问题来自试图在这里解决这一问题:
<一href=\"http://stackoverflow.com/questions/22672622/why-is-usermanager-createidentityasync-looking-for-identityrole-and-how-to-fix\">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之间实现差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆