Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net core identity - Id column is nvarchar(450) - why?

In the dbo.AspNetUsers table used by ASP.NET Core Identity the Id column is defined as nvarchar(450) as seen in the image below.

What is the reason for this, since Guids are stored in this column? If I am creating a foreign key referencing this Id column I don't really want to make the column unnecessarily large. Or is there a scenario when Id column of this size would be needed?

ASP.NET Core Identity Users table

like image 825
nomad Avatar asked Mar 25 '18 18:03

nomad


1 Answers

I have no idea why it's 450 in length, but it actually doesn't matter. The NVARCHAR type is dynamically sized, so the the number it's fed is actually a max length. It will only consume the amount of bytes necessary to store the data it's storing, regardless of the "length".

like image 169
Chris Pratt Avatar answered Nov 16 '22 13:11

Chris Pratt