<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Automatic Deactivation</title> <link rel="stylesheet" type="text/css" href="../../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Automatic Deactivation</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><br></p><p>The use of depth parameter in <code>deactivate</code> call from the <a href="rollback_and_cache.html" class="wikiLink">previous example</a> directly affects performance: the less is the depth the less objects will need to be re-read from the database and the better the performance will be. Ideally we only want to deactivate the objects that were changed in the rolled-back transaction. This can be done by providing a special class for db4o configuration. This class should implement <code>RollbackStrategy/IRollbackStrategy</code> interface and is configured as part of Transparent Persistence support:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPRollback.cs: <span class="fscMemberName">RollbackDeactivateStrategy</span></span></div><div class="fscCode"><pre ID="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</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;">class</span><span style="color: #000000;"> RollbackDeactivateStrategy : IRollbackStrategy </span><span style="color: #008080;">2</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_69_230_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Rollback(IObjectContainer container, Object obj) </span><span style="color: #008080;">4</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_RollbackDeactivateStrategy_658_75_156_220_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Ext().Deactivate(obj); </span><span style="color: #008080;">6</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;">7</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">TPRollback.cs: <span class="fscMemberName">ConfigureTPForRollback</span></span></div><div class="fscCode"><pre ID="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> IConfiguration ConfigureTPForRollback() </span><span style="color: #008080;">2</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ConfigureTPForRollback_737_71_63_356_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration(); </span><span style="color: #008080;">4</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;"> add TP support and rollback strategy</span><span style="color: #008000;"> </span><span style="color: #008080;">5</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> configuration.Add(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> TransparentPersistenceSupport( </span><span style="color: #008080;">6</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> RollbackDeactivateStrategy())); </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;">return</span><span style="color: #000000;"> configuration; </span><span style="color: #008080;">8</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">TPRollback.vb: <span class="fscMemberName">RollbackDeactivateStrategy</span></span></div><div class="fscCode"><pre ID="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Open_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Closed_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Closed_Text').style.display='inline';"/><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Closed_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Open_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class RollbackDeactivateStrategy</span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_8_309_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> RollbackDeactivateStrategy </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: #0000FF;">Implements</span><span style="color: #000000;"> IRollbackStrategy </span><span style="color: #008080;">3</span><span style="color: #000000;"><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Open_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Closed_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Closed_Text').style.display='inline';"/><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Closed_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Open_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Rollback()</span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_RollbackDeactivateStrategy_872_75_101_291_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Rollback(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer, </span><span style="color: #0000FF;">ByVal</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: #008080;">4</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IRollbackStrategy.Rollback </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Ext().Deactivate(obj) </span><span style="color: #008080;">6</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;">7</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Class</span></span></div></pre></div></div> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPRollback.vb: <span class="fscMemberName">ConfigureTPForRollback</span></span></div><div class="fscCode"><pre ID="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Open_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Closed_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Closed_Text').style.display='inline';"/><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Closed_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Open_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function ConfigureTPForRollback()</span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ConfigureTPForRollback_951_71_15_351_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> ConfigureTPForRollback() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </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: #0000FF;">Dim</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration() </span><span style="color: #008080;">3</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;"> add TP support and rollback strategy</span><span style="color: #008000;"> </span><span style="color: #008080;">4</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> configuration.Add(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> TransparentPersistenceSupport(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> RollbackDeactivateStrategy())) </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;">Return</span><span style="color: #000000;"> configuration </span><span style="color: #008080;">6</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> </span> <p>RollbackDeactivateStrategy#rollback method will be automatically called <b>once</b> per each <b>modified</b> object after the rollback. Thus you do not have to worry about deactivate depth anymore - all necessary deactivation will happen transparently preserving the best performance possible. </p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPRollback.cs: <span class="fscMemberName">ModifyWithRollbackStrategy</span></span></div><div class="fscCode"><pre ID="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> ModifyWithRollbackStrategy() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_57_1283_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTPForRollback()); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (container </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="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_183_1273_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_221_1162_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> create a car</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;"> Car car </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Car)container.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">null</span><span style="color: #000000;">, </span><span style="color: #0000FF;">null</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: #800080;">0</span><span style="color: #000000;">]; </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Pilot pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> car.Pilot; </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Initial car: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> car </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(car) </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Initial pilot: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilot </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(pilot) </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Model </span><span style="color: #000000;">=</span><span style="color: #000000;"> </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: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.ChangePilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Michael Schumacher</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">123</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"/> container.Rollback(); </span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Car after rollback: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> car </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(car) </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Pilot after rollback: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilot </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(pilot) </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">finally</span><span style="color: #000000;"> </span><span style="color: #008080;">25</span><span style="color: #000000;"><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Open_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Closed_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Closed_Text').style.display='inline';"/><img id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Closed_Text').style.display='none'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Open_Image').style.display='inline'; document.getElementById('....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Open_Text').style.display='inline';"/> </span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="....RollbackCS.ZipsTPRollback.Cs_TPRollback.Cs_ModifyWithRollbackStrategy_1399_75_1203_1259_Open_Text"><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"/> CloseDatabase(); </span><span style="color: #008080;">27</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;">28</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;">29</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">TPRollback.vb: <span class="fscMemberName">ModifyWithRollbackStrategy</span></span></div><div class="fscCode"><pre ID="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Open_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Closed_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Closed_Text').style.display='inline';"/><img id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Closed_Text').style.display='none'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Open_Image').style.display='inline'; document.getElementById('....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub ModifyWithRollbackStrategy()</span><span id="....RollbackVB.ZipsTPRollback.Vb_TPRollback.Vb_ModifyWithRollbackStrategy_1538_75_15_1204_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> ModifyWithRollbackStrategy() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTPForRollback()) </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">IsNot</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">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"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> create a car</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;"> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(container.QueryByExample(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">, </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">))(</span><span style="color: #800080;">0</span><span style="color: #000000;">), Car) </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;"> pilot </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> car.Pilot </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Initial car: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> car.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(car).ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Initial pilot: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilot.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(pilot).ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.Model </span><span style="color: #000000;">=</span><span style="color: #000000;"> </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: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car.ChangePilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Michael Schumacher</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">123</span><span style="color: #000000;">) </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Rollback() </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Car after rollback: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> car.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(car).ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Pilot after rollback: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> pilot.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">(</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> container.Ext().GetID(pilot).ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">)</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;"> </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseDatabase() </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</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: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div> </span> <p>Note, that RollbackDeactivateStrategy <b>only works for activatable</b> objects. To see the different you can comment out Activatable implementation in Id class (id value will be preserved in the cache).</p></div> </div> <div id="footer"> This revision (1) was last Modified 2008-03-02T09:33:56 by Tetyana. </div> </body> </html>