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.