<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Migrating Between Databases</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Migrating Between Databases</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>Transparent activation and persistence functionality depends on an association between an object and an object container, which is created when an activator is bound to the object. Each object allows only one activator. Typically this limitation won't show up, however there is a valid use case for it: </p> <p>1) suppose you need to copy one or more objects from one object container to another;</p> <p>2) you will retrieve the object(s) from the first object container using any suitable query syntax;</p> <p>3) optionally you can close the first object container;</p> <p>4) you will now save the object to the second object container.</p> <p>If both object containers were using transparent activation or persistence - the 4-th step will throw an exception. Let's look at the case in more detail. Typical activatable class contains an <code>activator</code> field. When transparent activation functionality is used for the first time an object container activator will be bound to the object:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">SensorPanelTA.cs: <span class="fscMemberName">Bind</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Open_Text').style.display='inline';"/><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_0_74_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;">Bind the class to the specified object container, create the activator</span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Bind(IActivator activator) </span><span style="color: #008080;">03</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_130_417_Open_Text"><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;">if</span><span style="color: #000000;"> (_activator </span><span style="color: #000000;">==</span><span style="color: #000000;"> activator) </span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_185_224_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"/> </span><span style="color: #0000FF;">return</span><span style="color: #000000;">; </span><span style="color: #008080;">07</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;">08</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;"> (activator </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">&&</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">!=</span><span style="color: #000000;"> _activator) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsSensorPanelTA.Cs_SensorPanelTA.Cs_Bind_1212_51_294_371_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"/> </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> System.InvalidOperationException(); </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"/> _activator </span><span style="color: #000000;">=</span><span style="color: #000000;"> activator; </span><span style="color: #008080;">13</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">SensorPanelTA.vb: <span class="fscMemberName">Bind</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_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: #008000;">'</span><span style="color: #008000;"> Bind the class to the specified object container, create the activator </span><span style="color: #008000;"> </span><span style="color: #008080;">02</span><span style="color: #008000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Bind()</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsSensorPanelTA.Vb_SensorPanelTA.Vb_Bind_1327_51_89_446_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Bind(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> activator </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IActivator) </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IActivatable.Bind </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;">If</span><span style="color: #000000;"> _activator </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> activator </span><span style="color: #0000FF;">Then</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;">Return</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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</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"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (activator </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;">Or</span><span style="color: #000000;"> _activator </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;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> System.InvalidOperationException() </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</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"/> _activator </span><span style="color: #000000;">=</span><span style="color: #000000;"> activator </span><span style="color: #008080;">10</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>If <code>bind</code> method will be re-called with the same object container, activator parameter will always be the same. However, if another object container tries to bind the object (in our case with the <code>store</code> call) activator parameter will be different, which will cause an exception. (Exception will be thrown even if the first object container is already closed, as activator object still exists in the memory.) This behaviour is illustrated with the following example (<a href="../../object_lifecycle/activation/transparent_activation_framework/detailed_example.html" class="wikiLink">SensorPanelTA</a> class from Transparent Activation chapter is used):</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TAExample.cs: <span class="fscMemberName">TestSwitchDatabases</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62"><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;"> TestSwitchDatabases() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_50_852_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"/> StoreSensorPanel(); </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: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer firstDb </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), FirstDbName); </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer secondDb </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), SecondDbName); </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="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_293_727_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"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> firstDb.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (result.Count </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: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_431_713_Open_Text"><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"/> SensorPanelTA sensor </span><span style="color: #000000;">=</span><span style="color: #000000;"> (SensorPanelTA)result[</span><span style="color: #800080;">0</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"/> firstDb.Close(); </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: #008000;">//</span><span style="color: #008000;"> Migrating an object from the first database </span><span style="color: #008080;">15</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> into a second database</span><span style="color: #008000;"> </span><span style="color: #008080;">16</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> secondDb.Store(sensor); </span><span style="color: #008080;">17</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;">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"/> </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> </span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabases_2109_62_760_842_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> firstDb.Close(); </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> secondDb.Close(); </span><span style="color: #008080;">23</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;">24</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">TAExample.vb: <span class="fscMemberName">TestSwitchDatabases</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestSwitchDatabases()</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabases_2235_62_15_830_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestSwitchDatabases() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> StoreSensorPanel() </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: #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;"> firstDb </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), FirstDbName) </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;"> secondDb </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), SecondDbName) </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;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> firstDb.QueryByExample(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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;">If</span><span style="color: #000000;"> result.Count </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;">Then</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"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sensor </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> SensorPanelTA </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(result(</span><span style="color: #800080;">0</span><span style="color: #000000;">), SensorPanelTA) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> firstDb.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: #008000;">'</span><span style="color: #008000;"> Migrating an object from the first database</span><span style="color: #008000;"> </span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008000;">'</span><span style="color: #008000;"> into a second database</span><span style="color: #008000;"> </span><span style="color: #008080;">13</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> secondDb.Store(sensor) </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</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 src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> firstDb.Close() </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> secondDb.Close() </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;">End</span><span style="color: #000000;"> </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/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div> </span> <p>The solution to this problem is simple: activator should be unbound from the object:</p> <span name="cs_wiki_filter" csw_filters="cs"> <p>c#:</p> <p><code>sensor.Bind(null);</code></p> </span> <span name="cs_wiki_filter" csw_filters="vb"> <p>VB:</p> <p><code>sensor.Bind(Nothing)</code></p> </span> <p>Note, that the object will quit being activatable for the first object container. The following example shows the described behaviour:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TAExample.cs: <span class="fscMemberName">TestSwitchDatabasesFixed</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67"><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;"> TestSwitchDatabasesFixed() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_55_2101_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"/> StoreSensorPanel(); </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: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer firstDb </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), FirstDbName); </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer secondDb </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), SecondDbName); </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="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_298_1976_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"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> firstDb.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (result.Count </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: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_436_1962_Open_Text"><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"/> SensorPanelTA sensor </span><span style="color: #000000;">=</span><span style="color: #000000;"> (SensorPanelTA)result[</span><span style="color: #800080;">0</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: #008000;">//</span><span style="color: #008000;"> Unbind the object from the first database</span><span style="color: #008000;"> </span><span style="color: #008080;">14</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> sensor.Bind(</span><span style="color: #0000FF;">null</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: #008000;">//</span><span style="color: #008000;"> Migrating the object into the second database</span><span style="color: #008000;"> </span><span style="color: #008080;">16</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> secondDb.Store(sensor); </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: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving previous query results from </span><span style="color: #800000;">"</span><span style="color: #000000;"> </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: #000000;">+</span><span style="color: #000000;"> FirstDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">:</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> SensorPanelTA next </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.Next; </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;">while</span><span style="color: #000000;"> (next </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #008080;">23</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_978_1099_Open_Text"><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"/> System.Console.WriteLine(next); </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> next </span><span style="color: #000000;">=</span><span style="color: #000000;"> next.Next; </span><span style="color: #008080;">26</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;">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"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving previous query results from </span><span style="color: #800000;">"</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: #000000;">+</span><span style="color: #000000;"> FirstDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;"> with manual activation:</span><span style="color: #800000;">"</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"/> firstDb.Activate(sensor, Int32.MaxValue); </span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> next </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.Next; </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: #0000FF;">while</span><span style="color: #000000;"> (next </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #008080;">33</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1424_1545_Open_Text"><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"/> System.Console.WriteLine(next); </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> next </span><span style="color: #000000;">=</span><span style="color: #000000;"> next.Next; </span><span style="color: #008080;">36</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;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving sensorPanel from </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> SecondDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">:</span><span style="color: #800000;">"</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"/> result </span><span style="color: #000000;">=</span><span style="color: #000000;"> secondDb.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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"/> next </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.Next; </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;">while</span><span style="color: #000000;"> (next </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #008080;">42</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_1823_1944_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"/> System.Console.WriteLine(next); </span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> next </span><span style="color: #000000;">=</span><span style="color: #000000;"> next.Next; </span><span style="color: #008080;">45</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;">46</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;">47</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;">48</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;">49</span><span style="color: #000000;"><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateCS.ZipsTAExample.Cs_TAExample.Cs_TestSwitchDatabasesFixed_2846_67_2009_2091_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">50</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> firstDb.Close(); </span><span style="color: #008080;">51</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> secondDb.Close(); </span><span style="color: #008080;">52</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;">53</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">TAExample.vb: <span class="fscMemberName">TestSwitchDatabasesFixed</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestSwitchDatabasesFixed()</span><span id="ResourcesReferenceUsage_PitfallsTransparent_ActivationMigrating_Between_DatabasesTAMigrateVB.ZipsTAExample.Vb_TAExample.Vb_TestSwitchDatabasesFixed_2977_67_15_2055_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestSwitchDatabasesFixed() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> StoreSensorPanel() </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: #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;"> firstDb </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), FirstDbName) </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;"> secondDb </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(ConfigureTA(), SecondDbName) </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;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> firstDb.QueryByExample(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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;">If</span><span style="color: #000000;"> result.Count </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;">Then</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"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> sensor </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> SensorPanelTA </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(result(</span><span style="color: #800080;">0</span><span style="color: #000000;">), SensorPanelTA) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> Unbind the object from the first database</span><span style="color: #008000;"> </span><span style="color: #008080;">11</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> sensor.Bind(</span><span style="color: #0000FF;">Nothing</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: #008000;">'</span><span style="color: #008000;"> Migrating the object into the second database</span><span style="color: #008000;"> </span><span style="color: #008080;">13</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> secondDb.Store(sensor) </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"/> </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving previous query results from </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> FirstDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">:</span><span style="color: #800000;">"</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"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> SensorPanelTA </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.NextSensor </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;">While</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #0000FF;">IsNot</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</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"/> System.Console.WriteLine([</span><span style="color: #0000FF;">next</span><span style="color: #000000;">]) </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;">next</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">].NextSensor </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">While</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: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving previous query results from </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> FirstDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;"> with manual activation:</span><span style="color: #800000;">"</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"/> firstDb.Activate(sensor, Int32.MaxValue) </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: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.NextSensor </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;">While</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #0000FF;">IsNot</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</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"/> System.Console.WriteLine([</span><span style="color: #0000FF;">next</span><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"/> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">].NextSensor </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">While</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"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Retrieving sensorPanel from </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> SecondDbName </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">:</span><span style="color: #800000;">"</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"/> result </span><span style="color: #000000;">=</span><span style="color: #000000;"> secondDb.QueryByExample(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> SensorPanelTA(</span><span style="color: #800080;">1</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;">next</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> sensor.NextSensor </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;">While</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">] </span><span style="color: #0000FF;">IsNot</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</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"/> System.Console.WriteLine([</span><span style="color: #0000FF;">next</span><span style="color: #000000;">]) </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;">next</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> [</span><span style="color: #0000FF;">next</span><span style="color: #000000;">].NextSensor </span><span style="color: #008080;">37</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;">While</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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</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"/> </span><span style="color: #0000FF;">Finally</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"/> firstDb.Close() </span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> secondDb.Close() </span><span style="color: #008080;">42</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;">43</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></div> </div> <div id="footer"> This revision (4) was last Modified 2008-01-12T19:40:37 by Tetyana. </div> </body> </html>