<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Cross-Type Verifiers</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Cross-Type Verifiers</description>
  <pubDate>Sat, 11 Apr 2026 06:03:22 -700</pubDate>
  <lastBuildDate>Thu, 13 Oct 2011 19:49:33 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3001</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Cross-Type Verifiers : Thank you, That worked a treat.I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11823#11823</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1292" rel="nofollow">jbelci</a><br /><strong>Subject:</strong> 3001<br /><strong>Posted:</strong> 13-Oct-2011 at 7:49pm<br /><br />Thank you, That worked a treat.<br><br>I was sure i tried something like that. I must have just stuffed up something somewhere.<br><br>Once again, thanks for the help and the quick responses<br><br>Jason<br>]]>
   </description>
   <pubDate>Thu, 13 Oct 2011 19:49:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11823#11823</guid>
  </item> 
  <item>
   <title>Cross-Type Verifiers : Ah I see. Then let&amp;#039;s see...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11819#11819</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3001<br /><strong>Posted:</strong> 13-Oct-2011 at 11:53am<br /><br />Ah I see. Then let's see if the following works. I've tested this on my machine (with Employee.Orders in NorthwindIB model) so it should.<div><br></div><div>You're actually quite close with a few changes.<br><div><br></div><div><div><table width="99%"><tr><td><pre class="BBcode"></div></div><div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp;private static Verifier GetPersonPositionVerifier()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string description =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Position dates must not overlap";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DelegateVerifier&lt;<b>PersonPosition</b>&gt; v = new DelegateVerifier&lt;</span><span ="Apple-style-span" style=": rgb251, 251, 253; "><b>PersonPosition</b></span><span ="Apple-style-span" style=": rgb251, 251, 253; ">&gt;(description, PersonPositionValidCondition);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.VerifierOptions.ExecutionModes =VerifierExecutionModes.InstanceAndOnAfterSetTriggers;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerItem startDateTriggerItem = new TriggerItem(typeof(PersonPosition), PersonPosition.PathFor(e =&gt; e.StartDate));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerLink startDateTriggerLink = new TriggerLink(startDateTriggerItem, GetPositionsAssociatedWithPerson, true);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.AddTrigger(startDateTriggerLink);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerItem endDateTriggerItem = new TriggerItem(typeof(PersonPosition), PersonPosition.PathFor(e =&gt; e.EndDate));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerLink endDateTriggerLink = new TriggerLink(endDateTriggerItem, GetPositionsAssociatedWithPerson, true);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.AddTrigger(endDateTriggerLink);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return v;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IEnumerable&lt;PersonPosition&gt; GetPositionsAssociatedWithPerson(Object <b>personPos</b>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var aPerson = <b>((PersonPosition)personPos).Person;</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return aPerson.PersonPositions;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></div></div><div></pre></td></tr></table></div></div>]]>
   </description>
   <pubDate>Thu, 13 Oct 2011 11:53:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11819#11819</guid>
  </item> 
  <item>
   <title>Cross-Type Verifiers : That is exactly correct, and I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11812#11812</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1292" rel="nofollow">jbelci</a><br /><strong>Subject:</strong> 3001<br /><strong>Posted:</strong> 12-Oct-2011 at 5:47pm<br /><br />That is exactly correct, and I have written that code above (close enough anyway) and it works fine. <br><br>The issue is that I want all overlapping PersonPosition objects to raise verification alerts when this happens, not just the one that was just edited.<br><br>Cheers<br>Jason<br><br>]]>
   </description>
   <pubDate>Wed, 12 Oct 2011 17:47:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11812#11812</guid>
  </item> 
  <item>
   <title>Cross-Type Verifiers : Hi Jason;I want to make sure I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11809#11809</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3001<br /><strong>Posted:</strong> 12-Oct-2011 at 1:04pm<br /><br /><span ="Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Hi Jason;<div><br></div><div>I want to make sure I understand your business rule.</div><div><br></div><div>You have a Person and it has PersonPosition collections. Each PersonPosition has a StartDate and EndDate. You want to make sure that the dates do not overlap with the other PersonPosition, in other words, a Person should only hold at most 1 position (PersonPosition) at any given time within a company.</div><div><br></div><div>This means that you're only comparing between a Person.PersonPositions collection. This is not exactly cross type verifiers as you're only verifying one type of object, the PersonPosition type.</div><div><br></div><div>One suggestion is to implement something similar to this.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">private static Verifier GetPersonPositionVerifier()<br>{<br>&nbsp; &nbsp; &nbsp;string description =&nbsp;"Position dates must not overlap";<br>&nbsp; &nbsp; &nbsp;DelegateVerifier&lt;PersonPosition&gt; v =&nbsp;</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new DelegateVerifier&lt;PersonPosition&gt;(description, PersonPositionValidCondition);<br><br>&nbsp; &nbsp; &nbsp;v.VerifierOptions.ExecutionModes =VerifierExecutionModes.InstanceAndOnAfterSetTriggers;<br>&nbsp; &nbsp; &nbsp;v.AddTrigger(PersonPosition.PathFor(p =&gt; p.StartDate));</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp; &nbsp;v.AddTrigger(PersonPosition.PathFor(p =&gt; p.EndDate));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br><br>&nbsp; &nbsp; &nbsp;return v;<br>}<br><br></span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">private static VerifierResult PersonPositionValidCondition</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp; (PersonPosition pTarget, TriggerContext pTriggerContext,&nbsp;VerifierContext pVerifierContext)<br>{<br><br>&nbsp; &nbsp;var allPositions = pTarget.Person.PersonPositions;<br>&nbsp; &nbsp;bool isOk = true;</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp;foreach(var aPosition in allPositions)</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp;{</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp; &nbsp; &nbsp; //insert logic to check against all other positions here</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp;</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">&nbsp; &nbsp;return VerifierResult(isOk);<br>}</span></div><div></pre></td></tr></table></div><div><br></div><div>I hope I'm on the right track here. Please do let me know if I'm not.</div><div><br></div></div></span>]]>
   </description>
   <pubDate>Wed, 12 Oct 2011 13:04:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11809#11809</guid>
  </item> 
  <item>
   <title>Cross-Type Verifiers : Hi Guys  I have been trying...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11789#11789</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1292" rel="nofollow">jbelci</a><br /><strong>Subject:</strong> 3001<br /><strong>Posted:</strong> 10-Oct-2011 at 7:44pm<br /><br />Hi Guys<br><br>I have been trying to implement cross type verifiers, followng the examples from http://drc.ideablade.com/xwiki/bin/view/Documentation/validation%2Dcreate%2Dcustom%2Dverifier.&nbsp; My first try worked fine, but i am now having some issues with a second object structure i am trying to implement it on.<br><br>I have 2 object types in my graph, these are Person and PersonPosition. The person position is a collection of positions the person held while employed by a company, each of these has a start and end date.<br><br>i,e,<br>Person<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PersonPositions (enumerable list of person position)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StartDate (propery of person position)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EndDate (propery of person position)<br><br>The business rule i am trying to implement is that none of the person positions' dates can overlap with other positions. I can do this in the person position object and it works reasonably well (shows that the position i just edited has an error), however when one of the dates is chaged, i want all the person positions to run validation to check against the other positions. This is so i can show the user all positions that have overlapping dates.<br><br>I tried to implement this at the person object level using the code below. it compiles and runs fine, but cant seem to get the triggers to fire. I am hoping its something small i am doing wrong.<br><br>///&lt;summary&gt;Get the PersonPosition Verifier.&lt;/summary&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private static Verifier GetPersonPositionVerifier()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string description =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Position dates must not overlap";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DelegateVerifier&lt;Person&gt; v = new DelegateVerifier&lt;Person&gt;(description, PersonPositionValidCondition);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.VerifierOptions.ExecutionModes =VerifierExecutionModes.InstanceAndOnAfterSetTriggers;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerItem startDateTriggerItem = new TriggerItem(typeof(PersonPosition), PersonPosition.PathFor(e =&gt; e.StartDate));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerLink startDateTriggerLink = new TriggerLink(startDateTriggerItem, GetPositionsAssociatedWithPerson, true);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.AddTrigger(startDateTriggerLink);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerItem endDateTriggerItem = new TriggerItem(typeof(PersonPosition), PersonPosition.PathFor(e =&gt; e.EndDate));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TriggerLink endDateTriggerLink = new TriggerLink(endDateTriggerItem, GetPositionsAssociatedWithPerson, true);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.AddTrigger(endDateTriggerLink);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return v;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IEnumerable&lt;PersonPosition&gt; GetPositionsAssociatedWithPerson(Object person)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var aPerson = (Person)person;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return aPerson.PersonPositions;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>private static VerifierResult PersonPositionValidCondition(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Person pTarget, TriggerContext pTriggerContext,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VerifierContext pVerifierContext)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Do validation stuff here<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br><br>Any help would be greatly appriciated<br><br>regards<br>Jason<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>]]>
   </description>
   <pubDate>Mon, 10 Oct 2011 19:44:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3001&amp;PID=11789#11789</guid>
  </item> 
 </channel>
</rss>