guid

GUID vs INT IDENTITY [duplicate]

纵然是瞬间 提交于 2019-11-27 03:24:10
Possible Duplicate: How do you like your primary keys? I'm aware of the benefits of using a GUID, as well as the benefits of using and INT as a PK in a database. Considering that a GUID is in essence a 128 bit INT and a normal INT is 32 bit, the INT is a space saver (though this point is generally moot in most modern systems). In the end, in what circumstances would you see yourself using an INT as a PK versus a GUID? Kimberley Tripp (SQLSkills.com) has an article on using GUID's as primary keys. She advices against it because of the unnecessary overhead. Apart from being a poor choice when

Regex to get a guid from a email reply

强颜欢笑 提交于 2019-11-27 03:16:13
问题 Trying to figure out the Regex pattern to match if an email contains a Guid, e.g. a141aa94-3bec-4b68-b562-6b05fc2bfa48-reply@site.com The Guid could potentially be anywhere before the @, e.g. reply-a141aa94-3bec-4b68-b562-6b05fc2bfa48@wingertdesign.com 回答1: I use this to find Guids Regex isGuid = new Regex(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled); 回答2: A lazy variant would be ([0-9a-f-]{36}).*?@ It is easy

UUID collision risk using different algorithms

坚强是说给别人听的谎言 提交于 2019-11-27 02:38:33
问题 I have a database where 2 (or maybe 3 or 4) different applications are inserting information. The new information has IDs of the type GUID/UUID, but each application is using a different algorithm to generate the IDs. For example, one is using the NHibernate's "guid.comb", other is using the SQLServer's NEWID(), other might want to use .NET's Guid.NewGuid() implementation. Is there an above normal risk of ID collision or duplicates? Thanks! 回答1: The risk of collisions is elevated slightly but

What are the chances to get a Guid.NewGuid () duplicate? [duplicate]

▼魔方 西西 提交于 2019-11-27 02:30:29
问题 Possible Duplicate: Is a GUID unique 100% of the time? Simple proof that GUID is not unique In MSDN you can read: The chance that the value of the new Guid will be all zeros or equal to any other Guid is very low. Say that you have an method that will create a file every second, and you use the method Guid.NewGuid() for filename, is it possible to get the same Guid then? Or will the local computer keep track in some way? How low is the chance ? 回答1: You would never run out of guids. The

How many characters are there in a GUID?

无人久伴 提交于 2019-11-27 02:28:35
问题 Using ASCII encoding, how many characters are there in a GUID? I'm interested in the Microsoft style, which includes the curly brackets and dashes. 回答1: From MSDN: A GUID is a 128-bit value consisting of one group of 8 hexadecimal digits, followed by three groups of 4 hexadecimal digits each, followed by one group of 12 hexadecimal digits. The following example GUID shows the groupings of hexadecimal digits in a GUID: 6B29FC40-CA47-1067-B31D-00DD010662DA From Wikipedia: Often braces are added

Guid is all 0's (zeros)?

爷,独闯天下 提交于 2019-11-27 01:25:56
问题 I'm testing out some WCF services that send objects with Guids back and forth. In my web app test code, I'm doing the following: var responseObject = proxy.CallService(new RequestObject { Data = "misc. data", Guid = new Guid() }); For some reason, the call to new Guid() is generating Guids with all 0's (zeros) like this: 00000000-0000-0000-0000-000000000000 What could be causing this? 回答1: Use the static method Guid.NewGuid() instead of calling the default constructor. var responseObject =

Guid Primary /Foreign Key dilemma SQL Server

吃可爱长大的小学妹 提交于 2019-11-27 00:58:08
问题 I am faced with the dilemma of changing my primary keys from int identities to Guid. I'll put my problem straight up. It's a typical Retail management app, with POS and back office functionality. Has about 100 tables. The database synchronizes with other databases and receives/ sends new data. Most tables don't have frequent inserts, updates or select statements executing on them. However, some do have frequent inserts and selects on them, eg. products and orders tables. Some tables have upto

How securely unguessable are GUIDs?

微笑、不失礼 提交于 2019-11-27 00:36:37
A while ago I worked on a web application where users could buy tickets. Due to the way our client's processes worked, what you effectively got as a result of your purchase was a URL with the ticket number in it. These were tickets to buy property in the Middle East, and each ticket was potentially worth around $3,000,000. Clearly dishing out sequential integers would have been a bad idea. We used GUIDs as they're basically unguessable, but my question is: are they secure enough? As I understand it, the GUIDs .NET produces are totally pseudo-random (except for a few non-varying bits). However,

Sequential GUID in Linq-to-Sql?

偶尔善良 提交于 2019-11-27 00:15:29
I just read a blog post about NHibernate's ability to create a GUID from the system time (Guid.Comb), thus avoiding a good amount of database fragmentation. You could call it the client-side equivalent to the SQL Server Sequential ID. Is there a way I could use a similar strategy in my Linq-to-Sql project (by generating the Guid in code)? COMBs are generated the following way: DECLARE @aGuid UNIQUEIDENTIFIER SET @aGuid = CAST(CAST(NEWID() AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER) Which transcribed into C# would look like this: public static unsafe Guid CombGuid() {

Guid.NewGuid() vs. new Guid()

无人久伴 提交于 2019-11-26 23:51:20
问题 What's the difference between Guid.NewGuid() and new Guid() ? Which one is preferred? 回答1: new Guid() makes an "empty" all-0 guid (00000000-0000-0000-0000-000000000000 is not very useful). Guid.NewGuid() makes an actual guid with a unique value, what you probably want. 回答2: Guid.NewGuid() creates a new UUID using an algorithm that is designed to make collisions very, very unlikely. new Guid() creates a UUID that is all-zeros. Generally you would prefer the former, because that's the point of