<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Committed Event Example</title> <link rel="stylesheet" type="text/css" href="../../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Committed Event Example</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>Committed callbacks can be used in various scenarios:</p> <ul><li>backup on commit;</li><li>database replication on commit;</li><li>client database synchronization.</li></ul> <p>In our example we will create an implementation for the last case. </p> <p>When several clients are working on the same objects it is very possible that the data will be outdated on some of the clients. Before the commit-callbacks feature was introduced the solution was to call <code>refresh</code> regularly to get object updates from the server. With the commit-callback this process can be easily automated:</p> <ul><li>objects are modified when the commit is done;</li><li>the successful commit triggers committed event on the clients;</li><li>committed event handler updates modified objects on the clients.</li></ul> <p>Let's open 2 clients, which will work with <a href="car.html" class="wikiLink">Car</a> objects, and register committed event listeners for them.</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">PushedUpdatesExample.cs: <span class="fscMemberName">OpenClient</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70"><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;"> IObjectContainer OpenClient() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_46_845_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"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_76_692_Open_Text"><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"/> IObjectContainer client </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, Port, User, </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Password); </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CommitEventHandler committedEventHandler </span><span style="color: #000000;">=</span><span style="color: #000000;"> CreateCommittedEventHandler(client); </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IEventRegistry eventRegistry </span><span style="color: #000000;">=</span><span style="color: #000000;"> EventRegistryFactory.ForObjectContainer(client); </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> eventRegistry.Committed </span><span style="color: #000000;">+=</span><span style="color: #000000;"> committedEventHandler; </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;"> save the client-listener pair in a map, so that we can </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: #008000;">//</span><span style="color: #008000;"> remove the listener later</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;"> clientListeners.Add(client, committedEventHandler); </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> client; </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">catch</span><span style="color: #000000;"> (Exception ex) </span><span style="color: #008080;">16</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_OpenClient_1011_70_738_810_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString()); </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;">return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">; </span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">PushedUpdatesExample.cs: <span class="fscMemberName">CreateCommittedEventHandler</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87"><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;"> CommitEventHandler CreateCommittedEventHandler(IObjectContainer objectContainer) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_97_628_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"/> </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> CommitEventHandler(</span><span style="color: #0000FF;">delegate</span><span style="color: #000000;">(</span><span style="color: #0000FF;">object</span><span style="color: #000000;"> sender, CommitEventArgs args) </span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_203_616_Open_Text"><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: #008000;">//</span><span style="color: #008000;"> get all the updated objects</span><span style="color: #008000;"> </span><span style="color: #008080;">06</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> IObjectInfoCollection updated </span><span style="color: #000000;">=</span><span style="color: #000000;"> args.Updated; </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: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">foreach</span><span style="color: #000000;"> (IObjectInfo info </span><span style="color: #0000FF;">in</span><span style="color: #000000;"> updated) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CreateCommittedEventHandler_1085_87_401_598_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"/> Object obj </span><span style="color: #000000;">=</span><span style="color: #000000;"> info.GetObject(); </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;"> refresh object on the client</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;"> objectContainer.Ext().Refresh(obj, </span><span style="color: #800080;">2</span><span style="color: #000000;">); </span><span style="color: #008080;">13</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;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;">); </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/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">PushedUpdatesExample.vb: <span class="fscMemberName">OpenClient</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function OpenClient()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_OpenClient_1236_70_8_843_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> OpenClient() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Try</span><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"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> client </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenClient(</span><span style="color: #800000;">"</span><span style="color: #800000;">localhost</span><span style="color: #800000;">"</span><span style="color: #000000;">, Port, User, Password) </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;"> committedEventHandler </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> CommittedEventHandler </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> CommittedEventHandler(client) </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;"> eventRegistry </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IEventRegistry </span><span style="color: #000000;">=</span><span style="color: #000000;"> EventRegistryFactory.ForObjectContainer(client) </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;">AddHandler</span><span style="color: #000000;"> eventRegistry.Committed, </span><span style="color: #0000FF;">AddressOf</span><span style="color: #000000;"> committedEventHandler.OnCommitted </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: #008000;">'</span><span style="color: #008000;"> save the client-listener pair in a map, so that we can</span><span style="color: #008000;"> </span><span style="color: #008080;">08</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;"> remove the listener later</span><span style="color: #008000;"> </span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> clientListeners.Add(client, committedEventHandler) </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;">Return</span><span style="color: #000000;"> client </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString) </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Function</span></span></div></pre></div></div> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">CommittedEventHandler.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60"><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;"> Copyright (C) 2007 db4objects Inc. http://www.db4o.com</span><span style="color: #008000;"> </span><span style="color: #008080;">02</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Events </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Ext </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Foundation </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_177_1191_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.CommitCallbacks </span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class CommittedEventHandler</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_233_1177_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> CommittedEventHandler </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: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Private</span><span style="color: #000000;"> _objectContainer </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </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: #008080;">13</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Delegate</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub OnCommittedHandler()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_341_1177_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> OnCommittedHandler(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> sender </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Object</span><span style="color: #000000;">, </span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> args </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> CommitEventArgs) </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 id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub New()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_435_548_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;">(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> objectContainer </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer) </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _objectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> objectContainer </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span><span style="color: #000000;"> </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 id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function CreateCommittedEventHandler()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_566_729_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> CreateCommittedEventHandler(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> objectContainer </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer) </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> OnCommittedHandler </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;">Return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">AddressOf</span><span style="color: #000000;"> OnCommitted </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Function</span></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 id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub OnCommitted()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsCommittedEventHandler.Vb_CommittedEventHandler.Vb_1310_60_746_1162_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> OnCommitted(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> sender </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Object</span><span style="color: #000000;">, </span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> args </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> CommitEventArgs) </span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> get all the updated objects</span><span style="color: #008000;"> </span><span style="color: #008080;">25</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> updated </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectInfoCollection </span><span style="color: #000000;">=</span><span style="color: #000000;"> args.Updated </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;">For</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Each</span><span style="color: #000000;"> info </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectInfo </span><span style="color: #0000FF;">In</span><span style="color: #000000;"> updated </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: #0000FF;">Dim</span><span style="color: #000000;"> obj </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Object</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> info.GetObject() </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: #008000;">'</span><span style="color: #008000;"> refresh object on the client</span><span style="color: #008000;"> </span><span style="color: #008080;">29</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> _objectContainer.Ext().Refresh(obj, </span><span style="color: #800080;">2</span><span style="color: #000000;">) </span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Next</span><span style="color: #000000;"> </span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span><span style="color: #000000;"> </span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Class</span></span></span><span style="color: #000000;"> </span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/></span><span style="color: #0000FF;">End Namespace</span></span></div></pre></div></div> </span><p>Run the following method to see how the 2 clients work concurrently on the same object:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">PushedUpdatesExample.cs: <span class="fscMemberName">Run</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63"><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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Run() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_26_2262_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> File.Delete(Db4oFileName); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectServer server </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenServer(Db4oFileName, Port); </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;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_174_2054_Open_Text"><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"/> server.GrantAccess(User, Password); </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: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer client1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> OpenClient(); </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer client2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> OpenClient(); </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: #008080;">12</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;"> (client1 </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;"> client2 </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;">13</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_416_2040_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_462_1708_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> wait for the operations to finish</span><span style="color: #008000;"> </span><span style="color: #008080;">17</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> WaitForCompletion(); </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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> save pilot with client1</span><span style="color: #008000;"> </span><span style="color: #008080;">20</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Car client1Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">Ferrari</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">2006</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Schumacher</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"/> client1.Set(client1Car); </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Commit(); </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion(); </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> retrieve the same pilot with client2</span><span style="color: #008000;"> </span><span style="color: #008080;">27</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Car client2Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Car)client2.Query(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Car)).Next(); </span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(client2Car); </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: #008080;">30</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;"> modify the pilot with client1</span><span style="color: #008000;"> </span><span style="color: #008080;">31</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> client1Car.Model </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">2007</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"/> client1Car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Hakkinnen</span><span style="color: #800000;">"</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"/> client1.Set(client1Car); </span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Commit(); </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion(); </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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> client2Car has been automatically updated in </span><span style="color: #008080;">39</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;"> the committed event handler because of the </span><span style="color: #008080;">40</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;"> modification and the commit by client1</span><span style="color: #008000;"> </span><span style="color: #008080;">41</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> System.Console.WriteLine(client2Car); </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: #008080;">43</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion(); </span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">45</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">catch</span><span style="color: #000000;"> (Exception ex) </span><span style="color: #008080;">46</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1770_1858_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">47</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString()); </span><span style="color: #008080;">48</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">49</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> </span><span style="color: #008080;">50</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_1907_2022_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">51</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseClient(client1); </span><span style="color: #008080;">52</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseClient(client2); </span><span style="color: #008080;">53</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;">54</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;">55</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;">56</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">catch</span><span style="color: #000000;"> (Exception ex) </span><span style="color: #008080;">57</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2100_2172_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">58</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString()); </span><span style="color: #008080;">59</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;">60</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;">61</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_Run_1533_63_2205_2252_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">62</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> server.Close(); </span><span style="color: #008080;">63</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;">64</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">PushedUpdatesExample.vb: <span class="fscMemberName">Run</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Run()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_Run_1660_63_7_2100_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Run() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> File.Delete(Db4oFileName) </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> server </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectServer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenServer(Db4oFileName, Port) </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> server.GrantAccess(User, Password) </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> client1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> OpenClient </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;"> client2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> OpenClient </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;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (client1 </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;">AndAlso</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (client2 </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;">09</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;">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;"> wait for the operations to finish</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;"> WaitForCompletion() </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: #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;">save pilot with client1</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;"> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> client1Car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">Ferrari</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">2006</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Schumacher</span><span style="color: #800000;">"</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"/> client1.Set(client1Car) </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Commit() </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion() </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"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> retrieve the same pilot with client2</span><span style="color: #008000;"> </span><span style="color: #008080;">20</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> client2Car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(client2.Query(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Car)).Next, Car) </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(client2Car) </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"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> modify the pilot with client1</span><span style="color: #008000;"> </span><span style="color: #008080;">24</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> client1Car.Model </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">2007</span><span style="color: #000000;"> </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1Car.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Hakkinnen</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Set(client1Car) </span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client1.Commit() </span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion() </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: #008080;">30</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;"> client2Car has been automatically updated in</span><span style="color: #008000;"> </span><span style="color: #008080;">31</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;"> the committed event handler because of the</span><span style="color: #008000;"> </span><span style="color: #008080;">32</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;"> modification and the commit by client1</span><span style="color: #008000;"> </span><span style="color: #008080;">33</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> System.Console.WriteLine(client2Car) </span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> WaitForCompletion() </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString) </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;">Finally</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"/> CloseClient(client1) </span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseClient(client2) </span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </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;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.ToString) </span><span style="color: #008080;">44</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;">45</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> server.Close() </span><span style="color: #008080;">46</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;">47</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>You should see that client2 picked up the changes committed from the client1 automatically due to the committed event handler.</p> <p>Working with the committed event you should remember that the listener is called in a separate thread, which needs to be synchronized with the main application thread. This functionality is not implemented in the presented example, instead a simple thread Sleep(1000) method is used (WaitForCompletion method), which is not realiable at all. For a reliable execution use events and notifications from the committed callbacks.<br></p> <p>It is a good practice to remove the committed event handlers from the registry before shutting down the clients:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">PushedUpdatesExample.cs: <span class="fscMemberName">CloseClient</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71"><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;">void</span><span style="color: #000000;"> CloseClient(IObjectContainer client) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_58_459_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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> remove listeners before shutting down</span><span style="color: #008000;"> </span><span style="color: #008080;">04</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (clientListeners[client] </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;">05</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksCS.ZipsPushedUpdatesExample.Cs_PushedUpdatesExample.Cs_CloseClient_2491_71_174_421_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"/> IEventRegistry eventRegistry </span><span style="color: #000000;">=</span><span style="color: #000000;"> EventRegistryFactory.ForObjectContainer(client); </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> eventRegistry.Committed </span><span style="color: #000000;">-=</span><span style="color: #000000;"> (CommitEventHandler)clientListeners[client]; </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> clientListeners.Remove(client); </span><span style="color: #008080;">09</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;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Close(); </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div> </span> <p><span name="cs_wiki_filter" csw_filters="vb"></p> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">PushedUpdatesExample.vb: <span class="fscMemberName">CloseClient</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub CloseClient()</span><span id="ResourcesReferenceImplementation_StrategiesCallbacksCommit-Time_CallbacksCommitCallbacksVB.ZipsPushedUpdatesExample.Vb_PushedUpdatesExample.Vb_CloseClient_2633_71_8_512_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> CloseClient(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> client </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer) </span><span style="color: #008080;">2</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;"> remove listeners before shutting down</span><span style="color: #008000;"> </span><span style="color: #008080;">3</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (clientListeners(client) </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;">4</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;"> eventRegistry </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IEventRegistry </span><span style="color: #000000;">=</span><span style="color: #000000;"> EventRegistryFactory.ForObjectContainer(client) </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">RemoveHandler</span><span style="color: #000000;"> eventRegistry.Committed, </span><span style="color: #0000FF;">AddressOf</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(clientListeners(client), CommittedEventHandler).OnCommitted </span><span style="color: #008080;">6</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> clientListeners.Remove(client) </span><span style="color: #008080;">7</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;">8</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> client.Close() </span><span style="color: #008080;">9</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 (3) was last Modified 2007-05-02T13:29:18 by Tetyana. </div> </body> </html>