Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 502

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unique Universal IDs</title>
    <link rel="stylesheet" type="text/css" href="../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Unique Universal IDs</h1><script>
//We attach this function to a browser object as a variable so that if multiple of these blocks are
//present on the same page, then they will simply over-write eachother with the same function instead
//of generating a naming collision.
window.WikiCodeFormattingCopyToClipboard = function copyToClipboard(sID){
	var sContent = document.getElementById(sID).innerText;
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", sContent);
	}
	else
	{
		alert("You must enable javascript access to your clipboard for this feature to work. Please referr to your browser documentation or Google search for instructions.");
	}
}
</script>


<p>For long-term external references and to identify an object even after it has been copied or moved to another ObjectContainer, db4o supplies Unique Universal IDs (UUIDs).</p>

<p>
Every newly created db4o database generates a signature object. It is stored as an instance of Db4oDatabase in your database file.</p>

<p>This signature is linked to all newly created objects (if UUID generation is enabled) as the "signature part" of the UUID.</p>

<p>Further to that db4o creates a timestamp for every new object and uses an internal counter to make sure that timestamps are unique. This is called the "long part" of the UUID.</p>

<p>The long part is indexed to make the search fast. If two objects with an identical long parts are found, the signature parts are compared also.</p>

<p>The long part of the UUID can also be used to find out when an object was created. You can use </p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:</p>
<p><code>Db4objects.Db4o.Foundation.TimeStampIdGenerator#IdToMilliseconds()</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>VB:</p>
<p><code>Db4objects.Db4o.Foundation.TimeStampIdGenerator#IdToMilliseconds()</code></p>
</span>

<p>to get object creation time in milliseconds.</p>

<p>
UUIDs are guaranteed to be unique, if the signature of your db4o database is unique.</p>

<p>
Normally any database has a unique signature unless its file is copied. The original and copied database files are identical, so they have the same signatures. If such files are used in replication, the process will end up with exceptions. What is the solution then?</p>

<p>Signature of a database file can be changed using</p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:  </p>
<p><code>LocalObjectContainer#GenerateNewIdentity</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>VB: <code>LocalObjectContainer#GenerateNewIdentity</code></p>

</span>
method. 


<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.cs: <span class="fscMemberName">TestChangeIdentity</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TestChangeIdentity()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_43_1112_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      File.Delete(Db4oFileName);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      Db4oDatabase db;
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">byte</span><span style="color: #000000;">[] oldSignature;
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">byte</span><span style="color: #000000;">[] newSignature;
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_222_448_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        db </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().Identity();
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        oldSignature </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.GetSignature();
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">oldSignature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(oldSignature));
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                ((LocalObjectContainer)container).GenerateNewIdentity();
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_465_494_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        container.Close();
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">        
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_565_718_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        db </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().Identity();
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        newSignature </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.GetSignature();
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">newSignature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(newSignature));
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_735_764_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        container.Close();
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">bool</span><span style="color: #000000;"> same </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">true</span><span style="color: #000000;">;
</span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        
</span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">for</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> oldSignature.Length; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) 
</span><span style="color: #008080;">34</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_857_936_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(oldSignature[i] </span><span style="color: #000000;">!=</span><span style="color: #000000;"> newSignature[i])
</span><span style="color: #008080;">36</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_906_931_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>          same </span><span style="color: #000000;">=</span><span style="color: #0000FF;">false</span><span style="color: #000000;">;
</span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>        }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        
</span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (same)
</span><span style="color: #008080;">42</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_962_1028_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Database signatures are identical</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">45</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">else</span><span style="color: #000000;"> 
</span><span style="color: #008080;">46</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestChangeIdentity_2057_59_1042_1108_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">47</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Database signatures are different</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">48</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">49</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>    }</span></span></div></pre></div></div>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.vb: <span class="fscMemberName">TestChangeIdentity</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestChangeIdentity()</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestChangeIdentity_2180_59_14_1491_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestChangeIdentity()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(Db4oFileName)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName)
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Db4oDatabase
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> oldSignature() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Byte</span><span style="color: #000000;">
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> NewSignature() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Byte</span><span style="color: #000000;">
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().Identity()
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                oldSignature </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.GetSignature()
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">oldSignature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(oldSignature))
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> yf </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> LocalObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(container, LocalObjectContainer)
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                yf.GenerateNewIdentity()
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close()
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName)
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().Identity()
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                NewSignature </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.GetSignature()
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">newSignature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(NewSignature))
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close()
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> same </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Boolean</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">True</span><span style="color: #000000;">
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> i </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;">
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">For</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">To</span><span style="color: #000000;"> oldSignature.Length </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Step</span><span style="color: #000000;"> i </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;">
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> oldSignature(i) </span><span style="color: #000000;">&lt;&gt;</span><span style="color: #000000;"> NewSignature(i) </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    same </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">False</span><span style="color: #000000;">
</span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Next</span><span style="color: #000000;">
</span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> (same) </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Database signatures are identical</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Else</span><span style="color: #000000;">
</span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Database signatures are different</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>

<p>UUIDs are not generated by default, since they occupy extra space in the database file and produce performance overhead for maintaining their index. UUIDs can be turned on globally or for individual classes:</p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#: <code>configuration.GenerateUUIDs(ConfigScope.Globally)</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>VB: <code>configuration.GenerateUUIDs(ConfigScope.Globally)</code></p>

</span>

<p>- turns on UUID generation for all classes in a database. </p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:<code>configuration.ObjectClass(typeof(Foo)).GenerateUUIDs(true)</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>VB:<code>configuration.ObjectClass(GetType(Foo)).GenerateUUIDs(true)</code></p>

</span>

<p>- turns on UUID generation for a specific class.</p>

<p>You can get the UUID value for an object using the following methods:
</p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:</p>

<p><code>IEExtObjectContainer#GetObjectInfo(Object)<br>
IObjectInfo#GetUUID()</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>VB:</p>

<p><code>IExtObjectContainer#GetObjectInfo(Object)<br>
IObjectInfo#GetUUID()</code></p>

</span>

<p>To get the object from the database, knowing its UUID, use: </p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:</p>
<p><code>IExtObjectContainer#GetByUUID(Db4oUUID)</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>vb: </p>
<p><code>IExtObjectContainer#GetByUUID(Db4oUUID)</code></p>

</span>

<p>
The following example shows the usage of UUID: </p>
</p>

<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.cs: <span class="fscMemberName">SetObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> SetObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_35_471_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(Db4oFileName);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration();
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.ObjectClass(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Pilot)).GenerateUUIDs(</span><span style="color: #0000FF;">true</span><span style="color: #000000;">);
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName);
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_328_421_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">BMW</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Rubens Barrichello</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">));
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        container.Set(car);
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_SetObjects_4053_51_438_467_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        container.Close();
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>    }</span></span></div></pre></div></div>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.vb: <span class="fscMemberName">SetObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub SetObjects()</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_SetObjects_4168_51_14_541_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> SetObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            File.Delete(Db4oFileName)
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.ObjectClass(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Pilot)).GenerateUUIDs(</span><span style="color: #0000FF;">True</span><span style="color: #000000;">)
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName)
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">BMW</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Rubens Barrichello</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">))
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Set(car)
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close()
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>



<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.cs: <span class="fscMemberName">TestGenerateUUID</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TestGenerateUUID()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_41_1253_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> 
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_122_1195_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        IQuery query </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Query();
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        query.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Car));
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> query.Execute();
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Car)result[</span><span style="color: #800080;">0</span><span style="color: #000000;">];
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        IObjectInfo carInfo </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().GetObjectInfo(car);
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Db4oUUID carUUID </span><span style="color: #000000;">=</span><span style="color: #000000;"> carInfo.GetUUID();
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">UUID for Car class are not generated:</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Car UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> carUUID);
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Pilot pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> car.Pilot;
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        IObjectInfo pilotInfo </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().GetObjectInfo(pilot);
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Db4oUUID pilotUUID </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilotInfo.GetUUID();
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">UUID for Car class are not generated:</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotUUID);
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">long part: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotUUID.GetLongPart() </span><span style="color: #000000;">+</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">; signature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(pilotUUID.GetSignaturePart()));
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        </span><span style="color: #0000FF;">long</span><span style="color: #000000;"> ms </span><span style="color: #000000;">=</span><span style="color: #000000;"> TimeStampIdGenerator.IdToMilliseconds(pilotUUID.GetLongPart());
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot object was created: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> DateTime(</span><span style="color: #800080;">1970</span><span style="color: #000000;">,</span><span style="color: #800080;">1</span><span style="color: #000000;">,</span><span style="color: #800080;">1</span><span style="color: #000000;">)).AddMilliseconds(ms).ToString());
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Pilot pilotReturned </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Pilot)container.Ext().GetByUUID(pilotUUID);
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot from UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotReturned);  
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;"> 
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>      </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> 
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Open_Text').style.display='inline';"/>      </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsCS.ZipsUUIDExample.Cs_UUIDExample.Cs_TestGenerateUUID_4287_57_1212_1241_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>        container.Close();
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>      }</span></span><span style="color: #000000;">        
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>    }</span></span></div></pre></div></div>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">UUIDExample.vb: <span class="fscMemberName">TestGenerateUUID</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestGenerateUUID()</span><span id="ResourcesReferenceImplementation_StrategiesIDs_And_UUIDsuuidsVB.ZipsUUIDExample.Vb_UUIDExample.Vb_TestGenerateUUID_4408_57_14_1918_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestGenerateUUID()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName)
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> query </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Query()
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(car))
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> query.Execute()
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(result(</span><span style="color: #800080;">0</span><span style="color: #000000;">), Car)
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> carInfo </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectInfo </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().GetObjectInfo(car)
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> carUUID </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Db4oUUID </span><span style="color: #000000;">=</span><span style="color: #000000;"> carInfo.GetUUID()
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">UUID for Car class are not generated:</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> carUUID </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Car UUID: null</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Else</span><span style="color: #000000;">
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Car UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> carUUID.ToString())
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilot </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> car.Pilot
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilotInfo </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectInfo </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Ext().GetObjectInfo(pilot)
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilotUUID </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Db4oUUID </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilotInfo.GetUUID()
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">UUID for Car class are not generated:</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> pilotUUID </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot UUID: null</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Else</span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                    Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotUUID.ToString())
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;">
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">long part: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotUUID.GetLongPart().ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">; signature: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> PrintSignature(pilotUUID.GetSignaturePart()))
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> ms </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Long</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> TimeStampIdGenerator.IdToMilliseconds(pilotUUID.GetLongPart())
</span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot object was created: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> DateTime(</span><span style="color: #800080;">1970</span><span style="color: #000000;">, </span><span style="color: #800080;">1</span><span style="color: #000000;">, </span><span style="color: #800080;">1</span><span style="color: #000000;">)).AddMilliseconds(ms).ToString())
</span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilotReturned </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(container.Ext().GetByUUID(pilotUUID), Pilot)
</span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Pilot from UUID: </span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilotReturned.ToString())
</span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close()
</span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>

<p>Sometimes you can find out that you need UUIDs only when the database is already created and has some data in it. What can you do in that case?</p>

<p>Fortunately enabling replication for existing data files is a very simple process: </p>



<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:</p>
<p><code>configuration.ObjectClass(typeof(Task)).EnableReplication(true)</code></p>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<p>vb:   </p>
<p><code>configuration.ObjectClass(GetType(Task)).EnableReplication(true)</code></p>

</span>

<p>After that you will just need to use the old defragment tool from tools package supplied
with the distribution before version 6.0 (source code only) to enable replication.</p>

<p>You can use UUID for replication and as a reference to a specific object instance from an external application or data store.</p></div>
    </div>
    <div id="footer">
					This revision (17) was last Modified 2008-02-05T12:05:58 by dlouwers.
				</div>
  </body>
</html>