Entity Framework and SQL CE GUID as PK's [duplicate]
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.
精彩评论