<?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 : Interceptors not fired for changes made in AfterSet interceptor</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Interceptors not fired for changes made in AfterSet interceptor</description>
  <pubDate>Fri, 24 May 2013 16:33:25 -700</pubDate>
  <lastBuildDate>Wed, 09 Sep 2009 06:48:11 -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=1459</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>Interceptors not fired for changes made in AfterSet interceptor : Hi,  We&amp;#039;ve solved it as...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1459&amp;PID=5342#5342</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=472" rel="nofollow">Sinnema</a><br /><strong>Subject:</strong> 1459<br /><strong>Posted:</strong> 09-Sep-2009 at 6:48am<br /><br />Hi,<DIV>&nbsp;</DIV><DIV>We've solved it as shown below. Is that really the way to solve this? I would hate it to have to write that much code for each set of the same property in other Items. We noticed that when we set another property (i.e. not the property that is changing now) then the value is set correctly and it's interceptor is fired too.</DIV><DIV>&nbsp;</DIV><DIV>Regards,</DIV><DIV>Paul Sinnema.</DIV><DIV>Diartis AG</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&#091;AfterSet(EntityPropertyNames.IsPostal)&#093;<BR>&nbsp;&nbsp;public void AfterSetIsPostal(PropertyInterceptorArgs&lt;Address, Boolean&gt; args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;ResetIsPostal(args);<BR>&nbsp;&nbsp;}</DIV><DIV>&nbsp;&nbsp;private void ResetIsPostal(PropertyInterceptorArgs&lt;Address, Boolean&gt; args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if (args.Value)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;foreach (var item in this.Contact.AddressList.Where(address =&gt; !address.Equals(this)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (item.IsPostal)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.IsPostal = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FireIsPostalSetters(item, false);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</DIV><DIV>&nbsp;&nbsp;private void FireIsPostalSetters(Address address, bool value)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;var actions = Address.IsPostalEntityProperty.SetterInterceptor.GetActions();</DIV><DIV>&nbsp;&nbsp;&nbsp;var args = new DataEntityPropertySetInterceptorArgs&lt;Address, Boolean&gt;(Address.IsPostalEntityProperty, address, null);</DIV><DIV>&nbsp;&nbsp;&nbsp;args.Value = value;</DIV><DIV>&nbsp;&nbsp;&nbsp;foreach (var item in actions)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;item.Action(args);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</DIV>]]>
   </description>
   <pubDate>Wed, 09 Sep 2009 06:48:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1459&amp;PID=5342#5342</guid>
  </item> 
  <item>
   <title>Interceptors not fired for changes made in AfterSet interceptor : Hi,   We&amp;#039;ve created the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1459&amp;PID=5340#5340</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=472" rel="nofollow">Sinnema</a><br /><strong>Subject:</strong> 1459<br /><strong>Posted:</strong> 09-Sep-2009 at 6:03am<br /><br />Hi, <DIV>&nbsp;</DIV><DIV>We've created the following, very simple, code to reset booleans in other rows of a Navigation Property. The functionality should be like this:</DIV><DIV>- We have several Addresses but only 1 can be the Postal Address</DIV><DIV>- Each Address has an IsPostal boolean which tells if this Address is the Postal Address</DIV><DIV>- When a IsPostal for an Address is set to true, all others should be disabled automatically</DIV><DIV>&nbsp;</DIV><DIV>The code below works fine. The booleans for the other items are realy set to false but the Interceptors which are coupled to these properties are not fired. This behavior prevent our mask to be updated with the new values.</DIV><DIV>&nbsp;</DIV><DIV>Regards,</DIV><DIV>Paul Sinnema</DIV><DIV>Diartis AG</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&#091;AfterSet(EntityPropertyNames.IsPostal)&#093;<BR>&nbsp;&nbsp;public void AfterSetIsPostal(PropertyInterceptorArgs&lt;Address, Boolean&gt; args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;ResetIsPostal(args);<BR>&nbsp;&nbsp;}</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;private void ResetIsPostal(PropertyInterceptorArgs&lt;Address, Boolean&gt; args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if (args.Value)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;foreach (var item in this.Contact.AddressList.Where(address =&gt; !address.Equals(this)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (item.IsPostal)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.IsPostal = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</DIV><span style="font-size:10px"><br /><br />Edited by Sinnema - 09-Sep-2009 at 6:04am</span>]]>
   </description>
   <pubDate>Wed, 09 Sep 2009 06:03:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1459&amp;PID=5340#5340</guid>
  </item> 
 </channel>
</rss>