Why asp.net Identity user id is string?

后端 未结 2 594
悲哀的现实
悲哀的现实 2020-12-28 16:21

I want to use System.Guid type as an id for all of my tables in asp.net web api application. But I also use Asp.net Identity, which using a string-type id

2条回答
  •  误落风尘
    2020-12-28 16:41

    Depending on which version of ASP.Net authentication you're using, on the database ASP.NET Identity v2 should be storing it as a uniqueidentifier (Guid) in the AspNetUsers table. In more preceding versions it will store the user id as an int in the webpages_Membership table.

    I believe it surfaces it as a string so it can be any data type you like under the hood and this can then be cast within your code as required.

提交回复
热议问题