Customised IdentityUserRole primary key

此生再无相见时 提交于 2019-12-01 17:58:23

You need to customise all of your identity objects to specify different keys. There are various tutorials online but the best I've found is from www.asp.net.

Essentially you need to make your own version of each object but inherit from the more complex versions. For example, instead of:

public class ApplicationUser : IdentityUser
{
    ...
}

You would do this:

public class ApplicationUser : IdentityUser<int, CustomUserLogin, CustomUserRole, 
CustomUserClaim> 
{ 
    ...
}

And repeat for all object including UserStore, UserManager, RoleManager etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!