<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Collection Example</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Collection 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>In the <a href="detailed_example.html" class="wikiLink">previous example</a> we reviewed how Transparent Persistence should be used with simple types. Let's now look how it is done with the collections.</p> <p>In order to make collections TP Activatable you will need to use db4o-specific ArrayList4 collection. This collection implements .NET/Java collection interfaces, therefore it can be easily integrated with your code. The following class contains a collection of Pilot objects:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">Team.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Open_Text').style.display='inline';"/><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_0_67_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. </span><span style="color: #008000; text-decoration: underline;">http://www.db4o.com</span><span style="color: #008000;"> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> System.Collections.Generic; </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;">using</span><span style="color: #000000;"> System.Collections; </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: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o; </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: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.Activation; </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: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.TA; </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.Collections; </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.TPExample </span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_287_1956_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> Team : IActivatable </span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_330_1954_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: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IList</span><span style="color: #000000;"><</span><span style="color: #000000;">Pilot</span><span style="color: #000000;">></span><span style="color: #000000;"> _pilots </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> ArrayList4</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: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> _name; </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;">TA Activator</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;"> [System.NonSerialized] </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IActivator _activator; </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: #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;"> Bind the class to an object container</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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Bind(IActivator activator) </span><span style="color: #008080;">26</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_617_904_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (_activator </span><span style="color: #000000;">==</span><span style="color: #000000;"> activator) </span><span style="color: #008080;">28</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_672_711_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">return</span><span style="color: #000000;">; </span><span style="color: #008080;">30</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;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> (activator </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">&&</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">!=</span><span style="color: #000000;"> _activator) </span><span style="color: #008080;">32</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_781_858_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> System.InvalidOperationException(); </span><span style="color: #008080;">34</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;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _activator </span><span style="color: #000000;">=</span><span style="color: #000000;"> activator; </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> activate object fields </span><span style="color: #008000;"> </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: #000000;"> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Activate(ActivationPurpose purpose) </span><span style="color: #008080;">40</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1005_1102_Open_Text"><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;">if</span><span style="color: #000000;"> (_activator </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #0000FF;">return</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"/> _activator.Activate(purpose); </span><span style="color: #008080;">43</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;">44</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> AddPilot(Pilot pilot) </span><span style="color: #008080;">46</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1154_1265_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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> activate before adding new pilots</span><span style="color: #008000;"> </span><span style="color: #008080;">48</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read); </span><span style="color: #008080;">49</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _pilots.Add(pilot); </span><span style="color: #008080;">50</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;">51</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">52</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;">int</span><span style="color: #000000;"> Size() </span><span style="color: #008080;">53</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1301_1433_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">54</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;"> activate before returning</span><span style="color: #008000;"> </span><span style="color: #008080;">55</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read); </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;">return</span><span style="color: #000000;"> _pilots.Count; </span><span style="color: #008080;">57</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;">58</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;"> end Size</span><span style="color: #008000;"> </span><span style="color: #008080;">59</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> ListAllPilots() </span><span style="color: #008080;">61</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1499_1741_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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> activate before printing the collection members</span><span style="color: #008000;"> </span><span style="color: #008080;">63</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read); </span><span style="color: #008080;">64</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;"> (Pilot pilot </span><span style="color: #0000FF;">in</span><span style="color: #000000;"> _pilots) </span><span style="color: #008080;">65</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1667_1731_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">66</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(pilot); </span><span style="color: #008080;">67</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;">68</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;">69</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">70</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;"> IList</span><span style="color: #000000;"><</span><span style="color: #000000;">Pilot</span><span style="color: #000000;">></span><span style="color: #000000;"> Pilots </span><span style="color: #008080;">71</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1786_1925_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">72</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">get</span><span style="color: #000000;"> </span><span style="color: #008080;">73</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTeam.Cs_Team.Cs_519_47_1817_1915_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">74</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Activate(ActivationPurpose.Read); </span><span style="color: #008080;">75</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;"> _pilots; </span><span style="color: #008080;">76</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;">77</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;">78</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;"> end Pilots</span><span style="color: #008000;"> </span><span style="color: #008080;">79</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #008080;">80</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;">81</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">Team.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47"><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) 2004 - 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;"> System.Collections.Generic </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 </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.Activation </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.TA </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: #0000FF;">Imports</span><span style="color: #000000;"> Db4objects.Db4o.Collections </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 src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/> </span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_223_2101_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.TPExample </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 id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class Team</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_274_2087_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> Team </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;">Implements</span><span style="color: #000000;"> IActivatable </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: #008080;">14</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;"> _pilots </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> Pilot) </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> ArrayList4(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> Pilot) </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;">Private</span><span style="color: #000000;"> _name </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">String</span><span style="color: #000000;"> </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> TA Activator</span><span style="color: #008000;"> </span><span style="color: #008080;">18</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> </span><span style="color: #000000;"><</span><span style="color: #000000;">Transient()</span><span style="color: #000000;">></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;">Private</span><span style="color: #000000;"> _activator </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IActivator </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: #008080;">21</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">ReadOnly</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Property Pilots()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_534_707_Open_Text"><span style="color: #0000FF;">Property</span><span style="color: #000000;"> Pilots() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> Pilot) </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Get</span><span style="color: #000000;"> </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Activate(ActivationPurpose.Read) </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;">Return</span><span style="color: #000000;"> _pilots </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Get</span><span style="color: #000000;"> </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Property</span></span><span style="color: #000000;"> </span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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: #008000;">'</span><span style="color: #008000;"> Bind the class to an object container</span><span style="color: #008000;"> </span><span style="color: #008080;">30</span><span style="color: #008000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Bind()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_773_1130_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Bind(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> activator </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IActivator) </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IActivatable.Bind </span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> _activator </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> activator </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> (activator </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Or</span><span style="color: #000000;"> _activator </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;">) </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> System.InvalidOperationException() </span><span style="color: #008080;">36</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;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _activator </span><span style="color: #000000;">=</span><span style="color: #000000;"> activator </span><span style="color: #008080;">38</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;">39</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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: #008000;">'</span><span style="color: #008000;"> activate object fields </span><span style="color: #008000;"> </span><span style="color: #008080;">41</span><span style="color: #008000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Open_Text').style.display='inline';"/></span><span style="color: #000000;"> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Activate()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1181_1418_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Activate(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> purpose </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ActivationPurpose) </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IActivatable.Activate </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;">If</span><span style="color: #000000;"> _activator </span><span style="color: #0000FF;">Is</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Nothing</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Then</span><span style="color: #000000;"> </span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #008080;">44</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;">45</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _activator.Activate(ActivationPurpose.Read) </span><span style="color: #008080;">46</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;">47</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">48</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub AddPilot()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1435_1609_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> AddPilot(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> pilot </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot) </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: #008000;">'</span><span style="color: #008000;"> activate before adding new pilots</span><span style="color: #008000;"> </span><span style="color: #008080;">50</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read) </span><span style="color: #008080;">51</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> _pilots.Add(pilot) </span><span style="color: #008080;">52</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;">53</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">54</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function Size()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1626_1791_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> Size() </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #008080;">55</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;"> activate before returning</span><span style="color: #008000;"> </span><span style="color: #008080;">56</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read) </span><span style="color: #008080;">57</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;"> _pilots.Count </span><span style="color: #008080;">58</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;">59</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">60</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub ListAllPilots()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTeam.Vb_Team.Vb_626_47_1808_2072_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> ListAllPilots() </span><span style="color: #008080;">61</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;"> activate before printing the collection members</span><span style="color: #008000;"> </span><span style="color: #008080;">62</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> Activate(ActivationPurpose.Read) </span><span style="color: #008080;">63</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;"> p </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #008080;">64</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;"> p </span><span style="color: #0000FF;">In</span><span style="color: #000000;"> _pilots </span><span style="color: #008080;">65</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(p) </span><span style="color: #008080;">66</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;">67</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;">68</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">69</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 style="color: #000000;"> </span><span style="color: #008080;">70</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>You can see that except for using ArrayList4, the implementation follows the same rules as in the previous <a href="detailed_example.html" class="wikiLink">simple example</a>.</p> <p>Its usage has no surprises as well:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPCollectionExample.cs: <span class="fscMemberName">StoreCollection</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78"><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;"> StoreCollection() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_46_795_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> File.Delete(Db4oFileName); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()); </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;">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;">06</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_200_785_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"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_238_540_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Team team </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Team(); </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;">for</span><span style="color: #000000;"> (</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;"><</span><span style="color: #000000;"> </span><span style="color: #800080;">10</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) </span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_353_441_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> team.AddPilot(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Pilot #</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i)); </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/InBlock.gif" align="top"/> container.Set(team); </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Commit(); </span><span style="color: #008080;">16</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;">17</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;">18</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_594_674_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.StackTrace); </span><span style="color: #008080;">20</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;">21</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;">22</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_StoreCollection_936_78_715_771_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseDatabase(); </span><span style="color: #008080;">24</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;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPCollectionExample.cs: <span class="fscMemberName">TestCollectionPersistence</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84"><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;"> TestCollectionPersistence() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_56_1797_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"/> StoreCollection(); </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()); </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;">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;">06</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_202_1165_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"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_240_787_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Team team </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Team)container.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Team()).Next(); </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;"> this method will activate all the members in the collection</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;"> IList</span><span style="color: #000000;"><</span><span style="color: #000000;">Pilot</span><span style="color: #000000;">></span><span style="color: #000000;"> pilots </span><span style="color: #000000;">=</span><span style="color: #000000;"> team.Pilots; </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;">foreach</span><span style="color: #000000;"> (Pilot p </span><span style="color: #0000FF;">in</span><span style="color: #000000;"> pilots) </span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_531_610_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"/> p.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Modified: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> p.Name; </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> team.AddPilot(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">New pilot</span><span style="color: #800000;">"</span><span style="color: #000000;">)); </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> explicitly commit to persist changes</span><span style="color: #008000;"> </span><span style="color: #008080;">18</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> container.Commit(); </span><span style="color: #008080;">19</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;">20</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;">21</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_841_918_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.Message); </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="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_959_1151_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"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> If TP changes were not committed explicitly, </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: #008000;">//</span><span style="color: #008000;"> they would be persisted with the #close call</span><span style="color: #008000;"> </span><span style="color: #008080;">28</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;"> CloseDatabase(); </span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">//</span><span style="color: #008000;"> reopen the database and check the changes</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;"> container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()); </span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">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;">34</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1319_1787_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">try</span><span style="color: #000000;"> </span><span style="color: #008080;">36</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1357_1545_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.QueryByExample(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Team()); </span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Team team </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Team)result[</span><span style="color: #800080;">0</span><span style="color: #000000;">]; </span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> team.ListAllPilots(); </span><span style="color: #008080;">40</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;">41</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;">42</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1599_1676_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.Message); </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;">finally</span><span style="color: #000000;"> </span><span style="color: #008080;">46</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionCS.ZipsTPCollectionExample.Cs_TPCollectionExample.Cs_TestCollectionPersistence_1018_84_1717_1773_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"/> CloseDatabase(); </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/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">50</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div> </p> </span> <span name="cs_wiki_filter" csw_filters="vb"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPCollectionExample.vb: <span class="fscMemberName">StoreCollection</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_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="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub StoreCollection()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_StoreCollection_1175_78_15_695_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> StoreCollection() </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;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()) </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: #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;">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 src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> team </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Team() </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;">For</span><span style="color: #000000;"> i </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">To</span><span style="color: #000000;"> </span><span style="color: #800080;">9</span><span style="color: #000000;"> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> team.AddPilot(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Pilot #</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i.ToString)) </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;">Next</span><span style="color: #000000;"> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Store(team) </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Commit() </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;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.StackTrace) </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseDatabase() </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </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;">18</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> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TPCollectionExample.vb: <span class="fscMemberName">TestCollectionPersistence</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_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="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestCollectionPersistence()</span><span id="ResourcesReferenceObject_LifecycleTransparent_PersistenceCollection_ExampletpexamplecollectionVB.ZipsTPCollectionExample.Vb_TPCollectionExample.Vb_TestCollectionPersistence_1255_88_15_1653_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestCollectionPersistence() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> StoreCollection() </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;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()) </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: #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;">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 src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> team </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Team </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;"> Team()).[</span><span style="color: #0000FF;">Next</span><span style="color: #000000;">](), Team) </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;"> this method will activate all the members in the collection</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: #0000FF;">Dim</span><span style="color: #000000;"> pilots </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList(</span><span style="color: #0000FF;">Of</span><span style="color: #000000;"> Pilot) </span><span style="color: #000000;">=</span><span style="color: #000000;"> team.Pilots </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;">For</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Each</span><span style="color: #000000;"> p </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #0000FF;">In</span><span style="color: #000000;"> pilots </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> p.Name </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Modified: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> p.Name </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;">Next</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"/> team.AddPilot(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">New pilot</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: #008000;">'</span><span style="color: #008000;"> explicitly commit to persist changes</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;"> container.Commit() </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;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.Message) </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;">Finally</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: #008000;">'</span><span style="color: #008000;"> If TP changes were not committed explicitly,</span><span style="color: #008000;"> </span><span style="color: #008080;">19</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;"> they would be persisted with the #close call</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;"> CloseDatabase() </span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008000;">'</span><span style="color: #008000;"> reopen the database and check the changes</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;"> container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Database(ConfigureTP()) </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">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;">26</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;">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;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.QueryByExample(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Team()) </span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> team </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Team </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(result(</span><span style="color: #800080;">0</span><span style="color: #000000;">), Team) </span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> team.ListAllPilots() </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;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(ex.Message) </span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Finally</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"/> CloseDatabase() </span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;"> </span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div> </span> <p>So the only thing you should remember when using TP with collections is to use ArrayList4 instead of platform-specific collection.<br></p> </div> </div> <div id="footer"> This revision (3) was last Modified 2008-01-26T16:31:16 by Tetyana. </div> </body> </html>