I\'m using Identity 2.1 to handle the user roles in my asp.net application. So far so good, i created new context extending from IdentityDBContext, extending the IdentityUse
okay so the problem was with the UserStore, the default declaration was
public class UserStore<TUser> : UserStore<TUser, IdentityRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>, IUserStore<TUser>, IUserStore<TUser, string>, IDisposable where TUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser {
which have IdentityRole explicitly declared instead of making it using the generic notation like TUser, so we just need to create another class extending from the parent UserStore:
public class CarbonUserStore<TUser> : UserStore<TUser, Role, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>, IUserStore<TUser>, IUserStore<TUser, string>, IDisposable where TUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser {
public CarbonUserStore(DbContext context) :base(context) {} }
Not cool Microsoft, I spent a day trying to figure it wait. However, it's added in the Identity package shipping with vNext(gotta love it bering open source): https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNet.Identity.EntityFramework/UserStore.cs
public class UserStore<TUser, TRole, TContext> : UserStore<TUser, TRole, TContext, string>
where TUser : IdentityUser, new()
where TRole : IdentityRole, new()
where TContext : DbContext
{
public UserStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}