Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Cisore on July 19, 2012, 05:50:08 pm
-
Hi,
I would like to add a row into the t_xref table.
But I don't know how generate new GUID for the column XRefID
Someone can help me ?
-
http://bit.ly/OqFRNL
Geert
-
given that a the goal of a forum is to help people.
I make a report of my recherche. (like this people how look answer on google will can find other answer that "look on Google" ) :
GUID it's not a ID specific at EA. (but at windows)
For generate it they are a library (in C# but certainly with other language to) : Guid
It's possible to generate new GUID with this code :
Guid g1 = Guid.NewGuid();
g1.ToString();
The guid generate looks like this :
02cdf22d-4f04-4e9a-9f3f-0a76234ee360
but the GUID in EA looks like this:
{9EB55AB6-7E25-4711-8F03-FA3E982652E1}
I think it's not important (but may be it's wrong)
For people how have the same question like me :
They have not method in EA for check if the GUID doesn't already exist in the Model.
-
A GUID is unique per se. You don't need to check. It's like betting that a butterfly's wing flap will start a hurricane that lifts a car and drops it on your house.
If you want to use GUIDs in EA you should enclose them in braces. I've never tested to supply something else, but just to be sure. I've also noticed that EA uses capital/lower case letters in a certain way in their GUIDs. I have also no idea how that will influence EA if this convention is broken.
q.
-
A GUID is unique per se. You don't need to check. It's like betting that a butterfly's wing flap will start a hurricane that lifts a car and drops it on your house.
I know that, but it's not real write !
128-bits is big enough and the generation algorithm is unique enough that if 1,000,000,000 GUIDs per second were generated for 1 year the probability of a duplicate would be only 50%.
It's a probability extremely low but not non-existent ! (I'm I favor the theory of many! <- don't know if it's name in english)
there was a time when it was thought that a IP on 32bits was sufficient ...
-
I'm curious: is it safe to generate the guid for an xref and include it in the table?
I mean, after all, you're by-passing the EA GUI.
Has anyone had experience with this?
regards,
Paulus
-
You can do that. But you should test extensively. Doing such things is always the last resort. Eat or die.
q.
-
if 1,000,000,000 GUIDs per second were generated for 1 year the probability of a duplicate would be only 50%.
I'm not very good in probability maths. But after that time you created 3*10^16 numbers out of 3*10^38. Seems unlikely that this results in 50% probability. It's more like 10^-22. Or you go on calculating a couple of universe life times...
But of course: the algorithm is human made. And the one from M$ will likely produce only 10^17 different numbers. So there you are with one year. What did Bill say? Never ever will a computer need more the 600 kB. So why produce more GUIDs than needed?
q.