开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜