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

时间:2018-03-25 18:54:22

标签: asp.net-core-2.0 asp.net-core-identity

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

1 个答案:

答案 0 :(得分:1)

我不知道为什么它的长度是450,但实际上并不重要。 NVARCHAR类型是动态调整大小的,因此它所提供的数字实际上是最大长度。无论“长度”如何,它只会消耗存储它所存储数据所需的字节数。