<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Using Evaluations</title> <link rel="stylesheet" type="text/css" href="../../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Using Evaluations</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>For a simple example, let's take a Car class keeping a history of SensorReadout instances in a List member. Now imagine that we wanted to retrieve all cars that have assembled an even number of history entries. A quite contrived and seemingly trivial example, however, it gets us into trouble: Collections are transparent to the query API, it just 'looks through' them at their respective members.</p> <p>So how can we get this done? Let's implement an Evaluation that expects the objects passed in to be instances of type Car and checks their history size.</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">EvenHistoryEvaluation.cs</span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Open_Text').style.display='inline';"/><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">/**/</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_0_67_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;"> Copyright (C) 2004 - 2007 db4objects Inc. </span><span style="color: #008000; text-decoration: underline;">http://www.db4o.com</span><span style="color: #008000;"> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"> </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">using</span><span style="color: #000000;"> Db4objects.Db4o.Query; </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 src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/></span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Evaluations </span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_139_341_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> EvenHistoryEvaluation : IEvaluation </span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_193_339_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> Evaluate(ICandidate candidate) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvenHistoryEvaluation.Cs_EvenHistoryEvaluation.Cs_630_56_242_336_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Car car</span><span style="color: #000000;">=</span><span style="color: #000000;">(Car)candidate.GetObject(); </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> candidate.Include(car.History.Count </span><span style="color: #000000;">%</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;"> </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">); </span><span style="color: #008080;">12</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;">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">EvenHistoryEvaluation.vb</span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56"><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.Query </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="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Open_Text').style.display='inline';"/></span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Namespace Db4objects</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_96_469_Open_Text"><span style="color: #0000FF;">Namespace</span><span style="color: #000000;"> Db4objects.Db4odoc.Evaluations </span><span style="color: #008080;">05</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Class EvenHistoryEvaluation</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_148_455_Open_Text"><span style="color: #0000FF;">Class</span><span style="color: #000000;"> EvenHistoryEvaluation </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;">Implements</span><span style="color: #000000;"> IEvaluation </span><span style="color: #008080;">07</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Open_Text').style.display='inline';"/> </span><span style="color: #0000FF;">Public</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub Evaluate()</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvenHistoryEvaluation.Vb_EvenHistoryEvaluation.Vb_750_56_222_440_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> Evaluate(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> candidate </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> ICandidate) </span><span style="color: #0000FF;">Implements</span><span style="color: #000000;"> IEvaluation.Evaluate </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;">Dim</span><span style="color: #000000;"> car </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">DirectCast</span><span style="color: #000000;">(candidate.GetObject(), Car) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> candidate.Include(car.History.Count </span><span style="color: #0000FF;">Mod</span><span style="color: #000000;"> </span><span style="color: #800080;">2</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">) </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span><span style="color: #000000;"> </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/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>To test it, let's add two cars with history sizes of one and two respectively:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">EvaluationExample.cs: <span class="fscMemberName">StoreCars</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62"><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(IObjectContainer db) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_StoreCars_963_62_53_375_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"/> Pilot pilot1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Michael Schumacher</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">100</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"/> Car car1 </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: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car1.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot1; </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car1.Snapshot(); </span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(car1); </span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> Pilot pilot2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Rubens Barrichello</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">99</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 car2 </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: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot2; </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Snapshot(); </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Snapshot(); </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(car2); </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">EvaluationExample.vb: <span class="fscMemberName">StoreCars</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub StoreCars()</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_StoreCars_1089_62_15_507_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> StoreCars(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer) </span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilot1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Michael Schumacher</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">100</span><span style="color: #000000;">) </span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> car1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">Ferrari</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car1.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot1 </span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car1.Snapshot() </span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(car1) </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;"> pilot2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Pilot(</span><span style="color: #800000;">"</span><span style="color: #800000;">Rubens Barrichello</span><span style="color: #800000;">"</span><span style="color: #000000;">, </span><span style="color: #800080;">99</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;">Dim</span><span style="color: #000000;"> car2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Car </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">New</span><span style="color: #000000;"> Car(</span><span style="color: #800000;">"</span><span style="color: #800000;">BMW</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> pilot2 </span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Snapshot() </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> car2.Snapshot() </span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> db.Set(car2) </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 Sub</span></span></div></pre></div></div> </span> <p>and run our evaluation against them:</p> <span name="cs_wiki_filter" csw_filters="cs"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">EvaluationExample.cs: <span class="fscMemberName">QueryWithEvaluation</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> QueryWithEvaluation(IObjectContainer db) </span><span style="color: #008080;">2</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Open_Text').style.display='inline';"/> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsCS.ZipsEvaluationExample.Cs_EvaluationExample.Cs_QueryWithEvaluation_1264_72_63_244_Open_Text"><span style="color: #000000;">{ </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IQuery query </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query(); </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> query.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;"> (Car)); </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> query.Constrain(</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> EvenHistoryEvaluation()); </span><span style="color: #008080;">6</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> IObjectSet result </span><span style="color: #000000;">=</span><span style="color: #000000;"> query.Execute(); </span><span style="color: #008080;">7</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(result); </span><span style="color: #008080;">8</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> }</span></span></div></pre></div></div> </span> <span name="cs_wiki_filter" csw_filters="vb"> <div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">EvaluationExample.vb: <span class="fscMemberName">QueryWithEvaluation</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72"><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: #008080;">1</span><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub QueryWithEvaluation()</span><span id="ResourcesReferenceObject_LifecycleQueryingSODA_EvaluationsevaluationsVB.ZipsEvaluationExample.Vb_EvaluationExample.Vb_QueryWithEvaluation_1400_72_15_314_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> QueryWithEvaluation(</span><span style="color: #0000FF;">ByVal</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer) </span><span style="color: #008080;">2</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> query </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query() </span><span style="color: #008080;">3</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> query.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Car)) </span><span style="color: #008080;">4</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> query.Constrain(</span><span style="color: #0000FF;">New</span><span style="color: #000000;"> EvenHistoryEvaluation()) </span><span style="color: #008080;">5</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> query.Execute() </span><span style="color: #008080;">6</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/> ListResult(result) </span><span style="color: #008080;">7</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/> </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div> </span></div> </div> <div id="footer"> This revision (9) was last Modified 2006-11-13T15:36:47 by Tetyana. </div> </body> </html>