Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 1293

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Transient Classes</title>
    <link rel="stylesheet" type="text/css" href="../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Transient Classes</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>Some of the classes are not supposed to be persistent. Of
course you can avoid saving their instances in your code and mark all their
occurrences in another classes as transient (<a href="transient_fields_in_java.html" class="wikiLink">Java</a>/<a href="transient_fields_in_.net.html" class="wikiLink">.NET</a>). But that needs some attention
and additional coding. You can achieve the same result in an easier way using
TransientClass interface:</p>


<span name="cs_wiki_filter" csw_filters="cs">

<p>c#:</p>

<p><code>Db4objects.Db4o.Types. ITransientClass</code></p>
</span>
<span name="cs_wiki_filter" csw_filters="vb">

<p>VB:</p>

<p><code>Db4objects.Db4o.Types. ITransientClass</code></p>


</span>
<p>TransientClass is a marker interface, which guarantees that
the classes implementing it will never be added to the class metadata. In fact
they are just skipped silently by db4o persistence mechanism.</p>

<p>An example of the TransientClass implementation is db4o
object container (we do not need to save a database into itself).</p>

<p>Let's look how it works on an example. We will create a
simplest class implementing TransientClass interface:</p>


<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">NotStorable.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55"><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;">using</span><span style="color: #000000;"> Db4objects.Db4o.Types;
</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: #008080;">03</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.SelectivePersistence
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_80_237_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>    </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> NotStorable: ITransientClass
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_125_235_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;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">override</span><span style="color: #000000;"> </span><span style="color: #0000FF;">string</span><span style="color: #000000;"> ToString()
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsNotStorable.Cs_NotStorable.Cs_1185_55_177_228_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"/>            </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">NotStorable class</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">;
</span><span style="color: #008080;">10</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;">11</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>    }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/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">NotStorable.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55"><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;"> Db4objects.Db4o.Types
</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: #008080;">04</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_96_357_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.SelectivePersistence
</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: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Open_Text').style.display='inline';"/>    </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class NotStorable</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_151_343_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> NotStorable
</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;">Implements</span><span style="color: #000000;"> ITransientClass
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Open_Text').style.display='inline';"/>        </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Overloads</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Overrides</span><span style="color: #000000;"> </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Function ToString()</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsNotStorable.Vb_NotStorable.Vb_1300_55_240_329_Open_Text"><span style="color: #0000FF;">Function</span><span style="color: #000000;"> ToString() </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;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Return</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;">NotStorable class</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">
</span><span style="color: #008080;">11</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;">12</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;">13</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>NotStorable class will be used as a field in two test
objects: <a href="transient_classes/test1.html" class="wikiLink">Test1</a> and <a href="transient_classes/test2.html" class="wikiLink">Test2</a>.</p>

<p>In our example we will use the default configuration and
save Test1 and Test2 objects just as usual:</p>

<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TransientClassExample.cs: <span class="fscMemberName">SaveObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77"><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;"> SaveObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_42_653_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;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_188_560_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: #008000;">//</span><span style="color: #008000;"> Save Test1 object with a NotStorable class field</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;">                Test1 test1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Test1(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Test1</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> NotStorable());
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Set(test1);
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">//</span><span style="color: #008000;"> Save Test2 object with a NotStorable class field</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;">                Test2 test2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Test2(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Test2</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> NotStorable(), test1);
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Set(test2);
</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"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_SaveObjects_1632_77_593_643_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close();
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/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">TransientClassExample.vb: <span class="fscMemberName">SaveObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub SaveObjects()</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_SaveObjects_1769_77_14_619_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> SaveObjects()
</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;"> Db4oFactory.OpenFile(Db4oFileName)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">'</span><span style="color: #008000;"> Save Test1 object with a NotStorable class field</span><span style="color: #008000;">
</span><span style="color: #008080;">06</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> test1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Test1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Test1(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Test1</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> NotStorable)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Set(test1)
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">'</span><span style="color: #008000;"> Save Test2 object with a NotStorable class field</span><span style="color: #008000;">
</span><span style="color: #008080;">09</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> test2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Test2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Test2(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Test2</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">, </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> NotStorable, test1)
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Set(test2)
</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;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                container.Close()
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>
</span>

<p>Now let's try to retrieve the saved objects:</p>

<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">TransientClassExample.cs: <span class="fscMemberName">RetrieveObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81"><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;"> RetrieveObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_46_439_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer container </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(Db4oFileName);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_153_346_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">//</span><span style="color: #008000;"> retrieve the results and check if the NotStorable instances were saved</span><span style="color: #008000;">
</span><span style="color: #008080;">07</span><span style="color: #008000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                IList result </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Get(</span><span style="color: #0000FF;">null</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"/>                ListResult(result);
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceCS.ZipsTransientClassExample.Cs_TransientClassExample.Cs_RetrieveObjects_1963_81_379_429_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"/>                container.Close();
</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/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">TransientClassExample.vb: <span class="fscMemberName">RetrieveObjects</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Open_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Closed_Image" src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub RetrieveObjects()</span><span id="ResourcesReferenceTuningSelective_PersistenceSelectivePersistenceVB.ZipsTransientClassExample.Vb_TransientClassExample.Vb_RetrieveObjects_2104_81_14_409_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> RetrieveObjects()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> container </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(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;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">'</span><span style="color: #008000;"> retrieve the results and check if the NotStorable instances were saved</span><span style="color: #008000;">
</span><span style="color: #008080;">05</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;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IList </span><span style="color: #000000;">=</span><span style="color: #000000;"> container.Get(</span><span style="color: #0000FF;">Nothing</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"/>                ListResult(result)
</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;">Finally</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"/>                container.Close()
</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;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>
</span>

If you will run the example code you will see
that all the instances of NotStorable class are set to null.
</div>
    </div>
    <div id="footer">
					This revision (4) was last Modified 2007-01-29T16:14:01 by Tetyana.
				</div>
  </body>
</html>