Why is there an implementation difference between the UserStore and the RoleStore?

asp.net-identity asp.net-mvc asp.net-mvc-5 entity-framework entity-framework-6

Question

This has no problems:

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

While this:

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

...produces the following compile time error:

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'.

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.

1
1
5/23/2017 10:31:49 AM

Accepted Answer

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.

1
3/27/2014 5:35:36 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow