Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did the new ASP.NET Identity tables stop using Guid (uniqueidentifier type) as keys?

I'm trying to understand why the new ASP.NET Identity tables stopped using Guid (uniqueidentifier type) as keys - instead it is now using nvarchar(128) but still keep a Guid as a string...

Isn't it a huge waste? (uniqueidentifier is just 2 integers vs the whole Guid as a 36 character string)

I'm suspecting that Entity Framework might be responsible for this...

Is it safe to change back to uniqueidentifier keys?

Can anyone tell me what are the benefits of using 36 character strings?

like image 717
Yovav Avatar asked Aug 21 '15 07:08

Yovav


1 Answers

Identity is built to work on multiple storage platforms and not every storage platform has Guid as a supported storage type.

You can change the default string pkey into Guid, but that involves some work on your C# models. Or you can change the pkey into an int - whatever you like. Just be aware that there is a huge debate about which is better.

like image 151
trailmax Avatar answered Sep 21 '22 23:09

trailmax