You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing difficulty in setting up User Store using this library. There is no sample or usage guide that clearly showcase how to setup user store. My code is as follows:
ApplicationUser.cs
public class ApplicationUser : IdentityUser<int,ApplicationUserLogin,ApplicationUserRole,ApplicationUserClaim>, IEntity<int>
{
}
ApplicationRole.cs
public class ApplicationRole : IdentityRole<int,ApplicationUserRole,IdentityRoleClaim<int>>, IEntity<int>
{
}
public class ApplicationUserRole : IdentityUserRole<int> { }
public class ApplicationUserClaim : IdentityUserClaim<int> { }
public class ApplicationUserLogin : IdentityUserLogin<int> { }
MyDbContext.cs
public class MyDbContext: IdentityDbContext<ApplicationUser, ApplicationRole,int,ApplicationUserLogin,ApplicationUserRole,ApplicationUserClaim,IdentityRoleClaim<int>>
{
public MyDbContext(string connectionString):base(connectionString)
{
}
}
and UserStore is this:
public class ApplicationUserStore : UserStore<ApplicationUser,ApplicationRole,ApplicationUserRole,ApplicationUserClaim,ApplicationUserLogin,IdentityRoleClaim<int>,MyDbContext,int>
{
public ApplicationUserStore(MyDbContext context) : base(context)
{
}
}
I am getting following run time exception:
System.ArgumentException: GenericArguments[0], 'ApplicationUser', on 'MR.AspNet.Identity.EntityFramework6.UserStore3[TUser,TRole,TContext]' violates the constraint of type 'TUser'. ---> System.TypeLoadException: GenericArguments[0], ApplicationUser', on 'MR.AspNet.Identity.EntityFramework6.UserStore8[TUser,TRole,TUserRole,TUserClaim,TUserLogin,TRoleClaim,TContext,TKey]' violates the constraint of type parameter 'TUser'.
What is going on here, and what am I doing wrong? Any samples, usage guide or solution appreciated?
Please note I have also tried this using int package i.e I have also tried using IdentityUserInt, IdentityRoleInt etc, but same exception.
The text was updated successfully, but these errors were encountered:
The reason there's no usage guide is that I depend on Identity's docs. I did my best to do everything similar to their own structure. Identity has some really complex generic usage, so it's not unexpected to face problems when you're doing your own impl.
I can help in pointing out what the error is if you publish a small repro of this. From just looking at it, I could't catch anything.
I am facing difficulty in setting up User Store using this library. There is no sample or usage guide that clearly showcase how to setup user store. My code is as follows:
ApplicationUser.cs
ApplicationRole.cs
ApplicationUserRole, ApplicationUserLogin,ApplicationUserClaim classes
MyDbContext.cs
and UserStore is this:
I am getting following run time exception:
System.ArgumentException: GenericArguments[0], 'ApplicationUser', on 'MR.AspNet.Identity.EntityFramework6.UserStore
3[TUser,TRole,TContext]' violates the constraint of type 'TUser'. ---> System.TypeLoadException: GenericArguments[0], ApplicationUser', on 'MR.AspNet.Identity.EntityFramework6.UserStore8[TUser,TRole,TUserRole,TUserClaim,TUserLogin,TRoleClaim,TContext,TKey]' violates the constraint of type parameter 'TUser'.
What is going on here, and what am I doing wrong? Any samples, usage guide or solution appreciated?
Please note I have also tried this using int package i.e I have also tried using IdentityUserInt, IdentityRoleInt etc, but same exception.
The text was updated successfully, but these errors were encountered: