<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Store Cars</title> <link rel="stylesheet" type="text/css" href="../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Store Cars</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> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MultiExamples.cs: <span class="fscMemberName">StoreCars</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> StoreCars() </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_40_1248_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(); </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="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_181_1238_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="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_219_817_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Car car; </span><span style="color: #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;"> ObjectCount; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) </span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_328_475_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"/> car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">BMW</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Test Pilot #</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i, i)); </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Set(car); </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">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;"> ObjectCount; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) </span><span style="color: #008080;">16</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_554_759_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">Ferrari</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Professional Pilot #</span><span style="color: #800000;">"</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: #000000;">+</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: #800080;">10</span><span style="color: #000000;">))); </span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Set(car); </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"/> container.Commit(); </span><span style="color: #008080;">22</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;">23</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;"> (Db4oException ex) </span><span style="color: #008080;">24</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_875_973_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Db4o Exception: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> ex.Message); </span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> }</span></span><span style="color: #000000;"> </span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">catch</span><span style="color: #000000;"> (Exception ex) </span><span style="color: #008080;">28</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1027_1127_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"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">System Exception: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> ex.Message); </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;">finally</span><span style="color: #000000;"> </span><span style="color: #008080;">32</span><span style="color: #000000;"><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionCS.ZipsMultiExamples.Cs_MultiExamples.Cs_StoreCars_57_59_1168_1224_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"/> CloseDatabase(); </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/ExpandedSubBlockEnd.gif" align="top"/> }</span></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></div></pre></div></div> </span> <span name="cs_wiki_filter" csw_filters="vb"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">MultiExamples.vb: <span class="fscMemberName">StoreCars</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_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="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub StoreCars()</span><span id="ResourcesReferenceImplementation_StrategiesNative_Query_CollectionnqcollectionVB.ZipsMultiExamples.Vb_MultiExamples.Vb_StoreCars_180_59_15_1122_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> StoreCars() </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() </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;"> </span><span style="color: #0000FF;">Not</span><span style="color: #000000;"> container </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;">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;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> i </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Integer</span><span style="color: #000000;"> </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">For</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">To</span><span style="color: #000000;"> ObjectCount </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Step</span><span style="color: #000000;"> i </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">BMW</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Test Pilot #</span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> i.ToString(), i)) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> container.Set(car) </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/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"/> </span><span style="color: #0000FF;">For</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;"> </span><span style="color: #0000FF;">To</span><span style="color: #000000;"> ObjectCount </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Step</span><span style="color: #000000;"> i </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">Ferrari</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Professional 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: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">10</span><span style="color: #000000;">).ToString(), (i </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800080;">10</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(car) </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;">Next</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"/> container.Commit() </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;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Db4oException </span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">Db4o Exception: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> ex.Message) </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;">Catch</span><span style="color: #000000;"> ex </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Exception </span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> System.Console.WriteLine(</span><span style="color: #800000;">"</span><span style="color: #800000;">System Exception: </span><span style="color: #800000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> ex.Message) </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 src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> CloseDatabase() </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: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">If</span><span style="color: #000000;"> </span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div></span> </div> </div> <div id="footer"> This revision (1) was last Modified 2007-04-23T19:58:03 by Tetyana. </div> </body> </html>