开发者

guid in System.Guid

As per MSDN,开发者_C百科 they describe System.Guid.NewGuid() as ..

The chance that the value of the new Guid will be all zeros or equal to any other Guid is very **low**

Will it be a bad idea to set customerID of Customer table to "uniqueidentifier" and generate the unique id using the System.Guid.NewGuid() ? How can I assure the method will generate only unique IDs ?


Unless you have very good reasons to use Guid as ID, I would recommend against using Guid as key. Guids take a lot of space in a database, and provide no benefit in common scenarios. Plus they do not play well with indexes.

Why don't you set the CustomerID as an integer and set it to auto-generate its value when you insert a new record?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜