Last post Aug 20, 2015 10:32 AM by Weibo Zhang
Aug 14, 2015 02:23 PM|shyamal890|LINK
I went through this article http://www.asp.net/identity/overview/extensibility/implementing-a-custom-mysql-aspnet-identity-storage-provider and
was able to make Identity 2.2.1 work with MySQL as database.
However, as soon as I try follow the link: http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity
I come to this instruction -->
In IdentityModels.cs, change the definition of the ApplicationDbContext class to use your new customized classes and an int for the key, as shown in the highlighted code.
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, CustomRole,
int, CustomUserLogin, CustomUserRole, CustomUserClaim>
However, for MySQL storage provider to work as per http://www.asp.net/identity/overview/extensibility/implementing-a-custom-mysql-aspnet-identity-storage-provider
I had changed the above code from
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
public class ApplicationDbContext : MySQLDatabase
So here, I am facing a problem, there is no extension that MySQLDatabase accepts as IdentityDbContext does. Can anyone please help me out here?
Aug 20, 2015 10:32 AM|Weibo Zhang|LINK
I think the two is not a similar class in this two articles. In the second article, the MySQLDatabase is just a Helper class, you could find out a passage explains that the “MySQLDatabase” contains the MySQL database connection and methods for performing
database operations. UserStore and RoleStore are both instantiated with an instance of this class in the “Data access layer classes” section. About the specific code, you could refer to the following link.
For the first ApplicationDbContext which is integrated from IdentityDbContext<ApplicationUser>, it represents a class which uses a custom user entity with a string primary key. For more things, you could refer to the following links.
I hope it’s useful to you.