Identity change GUID to int -


how 1 change pk column of aspnetuser table guid int data type? should possible latest asp.net-identity version got released today.

but can't find anywhere how done?

by default asp.net identity (using entity framework) uses strings primary keys, not guids, store guids in string.

you need define few more classes, i've created new project (i'm using vs2013 update 2 ctp), here identity models need change:

public class applicationuser : identityuser<int, applicationuserlogin, applicationuserrole, applicationuserclaim> {     public async task<claimsidentity> generateuseridentityasync(applicationusermanager manager)     {         // note authenticationtype must match 1 defined in cookieauthenticationoptions.authenticationtype         var useridentity = await manager.createidentityasync(this, defaultauthenticationtypes.applicationcookie);         // add custom user claims here         return useridentity;     } }  public class applicationuserrole : identityuserrole<int> { }  public class applicationuserlogin : identityuserlogin<int> { }  public class applicationuserclaim : identityuserclaim<int> { }  public class applicationrole : identityrole<int, applicationuserrole> { }  public class applicatonuserstore :     userstore<applicationuser, applicationrole, int, applicationuserlogin, applicationuserrole, applicationuserclaim> {     public applicatonuserstore(applicationdbcontext context)         : base(context)     {     } }  public class applicationdbcontext     : identitydbcontext<applicationuser, applicationrole, int, applicationuserlogin, applicationuserrole, applicationuserclaim> {     public applicationdbcontext()         : base("defaultconnection")     {     } } 

you'll need update few other places, follow compile errors, common change need convert string returned form user.identity.getuserid() integer.

also, in answering another question (i did ask question though), i've provided example solution this, see repository below:

https://github.com/jskimming/aspnet.identity.entityframework.multitenant


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -