ASP.NET Identity update column type for primary key Id in AspNetUsers table from a string to and int or a guid, yes or no?

二次信任 提交于 2020-01-04 00:14:52

问题


Today I read about the new features in ASP.NET Identity 2.0 alpha.

http://blogs.msdn.com/b/webdev/archive/2013/12/20/announcing-preview-of-microsoft-aspnet-identity-2-0-0-alpha1.aspx

Apparently the possibility to use and int or a guid as the primary key for the AspNetUsers table was added after numerous post/questions on stackoverflow.

I started using ASP.NET Identity when the RTM was announced. Since then I have been using the default string (nvarchar(128)) type for the Id column in the AspNetUsers table.

I want my app to be futureproof. So what I'm wordering is wheather or not I should follow the instructions in these new documents on how to change your Id column to and int or a guid.

What is the most appropriate for an e-commerce site?

What is the most appropriate for a regular site?

When to use what?

Update 1:

Already found one good thing about using an int while testing PrimaryKeysConfigTest WebForms sample app (https://aspnet.codeplex.com/SourceControl/latest Samples->Identity->ChangePK->PrimaryKeysConfigTest). When updating the table AspNetUserRoles manually in SQL Server Object Explorer you don't need to copy paste the long guid-string into the UserId and RoleId columns. You remember them by heart.

Update 2:

https://aspnet.codeplex.com/SourceControl/latest Samples->Identity->Identity-PasswordPolicy->Identity-PasswordPolicy is an MVC application and uses a nvarchar(128) for the Id column in AspNetUsers table. If you're looking to implement the new user account confirmation/forgot password features in ASP.NET Identity 2.0 alpha for an MVC application then this is the sample app you should look at.

来源:https://stackoverflow.com/questions/21383901/asp-net-identity-update-column-type-for-primary-key-id-in-aspnetusers-table-from

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