<?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 : Verifier trigger on entity subtype doesn&#039;t fire on set</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Verifier trigger on entity subtype doesn&#039;t fire on set</description>
  <pubDate>Fri, 24 May 2013 03:47:23 -700</pubDate>
  <lastBuildDate>Tue, 22 Sep 2009 10:23:01 -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=1485</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>Verifier trigger on entity subtype doesn&#039;t fire on set : By default the VerificationSetterOptions...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1485&amp;PID=5453#5453</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1485<br /><strong>Posted:</strong> 22-Sep-2009 at 10:23am<br /><br />By default the VerificationSetterOptions is set to 'None' for navigation properties.&nbsp;&nbsp; When off, no verifiers will be called when the setter is called.&nbsp; I don't really know why we have this default, but you can work around this limitation.&nbsp; The entity properties are immutable after creation, but fortunately you can use a property interceptor action to modify the options on the fly.&nbsp; The BeforeSet interceptor&nbsp;below sets the VerificationSetterOptions prior to invoking verification and the property setter.&nbsp; I used AfterSet verification here, but you can use before and/or after.&nbsp;<DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV><FONT size=2>&#091;</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>BeforeSet</FONT></FONT><FONT size=2>(</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EntityPropertyNames</FONT></FONT><FONT size=2>.DealConfStatus)&#093;</FONT></DIV><DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> BeforeSetStatus(</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>NavigationEntityPropertySetInterceptorArgs</FONT></FONT><FONT size=2>&lt;DealConfirmation</FONT><FONT size=2>, Status</FONT><FONT size=2>&gt; args) { </FONT></DIV><DIV><FONT size=2>&nbsp;&nbsp; args.VerificationSetterOptions = </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>VerificationSetterOptions</FONT></FONT><FONT size=2>.AfterSet;</FONT></DIV><DIV><FONT size=2>}</FONT></DIV><DIV><FONT size=2></pre></td></tr></table></FONT></DIV><DIV><FONT size=2>Once the interceptor action is in place, your custom verifier for the scalar navigation property will work.</FONT></DIV><DIV><FONT size=2>&nbsp;</DIV></FONT>]]>
   </description>
   <pubDate>Tue, 22 Sep 2009 10:23:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1485&amp;PID=5453#5453</guid>
  </item> 
  <item>
   <title>Verifier trigger on entity subtype doesn&#039;t fire on set : We are using a lot of Entities...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1485&amp;PID=5438#5438</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=549" rel="nofollow">DanW</a><br /><strong>Subject:</strong> 1485<br /><strong>Posted:</strong> 21-Sep-2009 at 8:46am<br /><br /><DIV></DIV>We are using a lot of Entities that have child types as keys, like status fields and such, and when a verifier trigger is set to fire on the change event for these types, it doesn't.&nbsp; In the example below, the Status can be several different values (and exists as a related entity to the parent entity) and two of them,&nbsp;disputed or no response, require a comment to be added to the&nbsp;record.&nbsp;&nbsp; The&nbsp;trigger on the comment field fires on set reliably,&nbsp; but the status change&nbsp;trigger only fires&nbsp;during the&nbsp;entity save, not during the&nbsp;property set.&nbsp;<DIV>&nbsp;</DIV><DIV>Here's the code:&nbsp;&nbsp; (the DealConfStatus is a type, the ConfComment is a string).</DIV><DIV></DIV><FONT size=2><P>&#091;</FONT><FONT color=#2b91af size=2>VerifierProvider</FONT><FONT size=2>&#093;</P><DIV></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>IEnumerable</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>Verifier</FONT><FONT size=2>&gt; GetVerifiers(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> verifierProviderContext)</DIV><P>{</P><P></FONT><FONT color=#2b91af size=2>List</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>Verifier</FONT><FONT size=2>&gt; verifiers = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>List</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>Verifier</FONT><FONT size=2>&gt;();</P><P>verifiers.Add(DisputeOrNoResponseStatusVerifier());</P><P>verifiers.Add(DisputeOrNoResponseCommentVerifier());</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> verifiers;</P><P>}</P><P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>Verifier</FONT><FONT size=2> DisputeOrNoResponseStatusVerifier()</P><P>{</P><P></FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> description = </FONT><FONT color=#a31515 size=2>"When a confirm is marked Disputed or No Response, the Comment must be updated"</FONT><FONT size=2>;</P><P></FONT><FONT color=#2b91af size=2>DelegateVerifier</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>&gt; verifier = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>DelegateVerifier</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>&gt;(description, DisputeCommentVerifierCondition);</P><P>verifier.AddTrigger(</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>.</FONT><FONT color=#2b91af size=2>EntityPropertyNames</FONT><FONT size=2>.DealConfStatus);</P><P>verifier.ExecutionModes = </FONT><FONT color=#2b91af size=2>VerifierExecutionModes</FONT><FONT size=2>.All;</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> verifier;</P><P>}</P><P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>Verifier</FONT><FONT size=2> DisputeOrNoResponseCommentVerifier()</P><P>{</P><P></FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> description = </FONT><FONT color=#a31515 size=2>"When a confirm is marked Disputed or No Response, the Comment must be updated"</FONT><FONT size=2>;</P><P></FONT><FONT color=#2b91af size=2>DelegateVerifier</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>&gt; verifier = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>DelegateVerifier</FONT><FONT size=2>&lt;</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>&gt;(description, DisputeCommentVerifierCondition);</P><P>verifier.AddTrigger(</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>.</FONT><FONT color=#2b91af size=2>EntityPropertyNames</FONT><FONT size=2>.ConfComment);</P><P>verifier.ExecutionModes = </FONT><FONT color=#2b91af size=2>VerifierExecutionModes</FONT><FONT size=2>.InstanceAndOnPostsetTriggers;</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> verifier;</P><P>}</P><P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>VerifierResult</FONT><FONT size=2> DisputeCommentVerifierCondition(</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2> dealConf, </FONT><FONT color=#2b91af size=2>TriggerContext</FONT><FONT size=2> triggerContext, </FONT><FONT color=#2b91af size=2>VerifierContext</FONT><FONT size=2> verifierContext)</P><P>{</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (dealConf.DealConfStatus.Key == </FONT><FONT color=#2b91af size=2>DealConfStatusEnum</FONT><FONT size=2>.Disputed || dealConf.DealConfStatus.Key == </FONT><FONT color=#2b91af size=2>DealConfStatusEnum</FONT><FONT size=2>.NoResponse)</P><P>{</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>VerifierResult</FONT><FONT size=2>(</FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>.ConfCommentEntityProperty.GetValue(dealConf, </FONT><FONT color=#2b91af size=2>EntityVersion</FONT><FONT size=2>.Original) != </FONT><FONT color=#2b91af size=2>DealConfirmation</FONT><FONT size=2>.ConfCommentEntityProperty.GetValue(dealConf, </FONT><FONT color=#2b91af size=2>EntityVersion</FONT><FONT size=2>.Current) &amp;&amp; dealConf.ConfComment != </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2> &amp;&amp; dealConf.ConfComment != </FONT><FONT color=#a31515 size=2>""</FONT><FONT size=2>);</P><P>}</P><P></FONT><FONT color=#0000ff size=2>else</P></FONT><FONT size=2><P>{</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>VerifierResult</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>);</P><P>}</P><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV></DIV><P>&nbsp;</P><DIV></DIV></FONT>]]>
   </description>
   <pubDate>Mon, 21 Sep 2009 08:46:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1485&amp;PID=5438#5438</guid>
  </item> 
 </channel>
</rss>