开发者

Entity Framework and SQL CE GUID as PK's [duplicate]

开发者 https://www.devze.com 2023-04-01 22:47 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Is a GUID unique 100% of the time?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Is a GUID unique 100% of the time?

I'm using GUID as my primary key columns for tables in a SQL CE 3.5 database that I'm performing CRUD operations on using Entity Framework.

When I create my id's I set them as

configuration.Id = Guid.NewGuid();

How unique is Guid? It's a pretty big string, is there any possibility that Guid.NewGuid() 开发者_运维技巧could return a value that it already used?


It is technically possible, but so unlikely that you don't have to worry about it.

Note that Guid.NewGuid is not kind to database index clustering. I did design a combed GUID for use on mobile devices back in the day if that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消