<?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 : Dynamic verification</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Dynamic verification</description>
  <pubDate>Mon, 13 Apr 2026 02:26:53 -700</pubDate>
  <lastBuildDate>Tue, 10 Apr 2012 05:04:27 -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=3376</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>Dynamic verification : Thanks Kim </title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13261#13261</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1431" rel="nofollow">jeanb</a><br /><strong>Subject:</strong> 3376<br /><strong>Posted:</strong> 10-Apr-2012 at 5:04am<br /><br />Thanks Kim]]>
   </description>
   <pubDate>Tue, 10 Apr 2012 05:04:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13261#13261</guid>
  </item> 
  <item>
   <title>Dynamic verification :   The problem with the DevForce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13247#13247</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> 3376<br /><strong>Posted:</strong> 06-Apr-2012 at 9:34am<br /><br />The problem with the DevForce VerifierEngine is that a new one is&nbsp;created automatically for each EntityManager.&nbsp; You can create a VerifierEngine separately and share it among EntityManagers (by calling the EM.VerifierEngine setter) but the VerifierEngine isn't thread safe, so if you're doing any multi-threading or async validation this won't work.<div>&nbsp;</div><div>As you noted, you could listen on EM creation and add verifiers then, but your on-demand approach of adding verifiers only for the entity types in use is a good alternative.</div><div>&nbsp;</div><div>I hope&nbsp;other DevForce users will chime in if they've&nbsp;encountered this problem and have suggestions.</div>]]>
   </description>
   <pubDate>Fri, 06 Apr 2012 09:34:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13247#13247</guid>
  </item> 
  <item>
   <title>Dynamic verification :   As an update, this is what...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13238#13238</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1431" rel="nofollow">jeanb</a><br /><strong>Subject:</strong> 3376<br /><strong>Posted:</strong> 05-Apr-2012 at 4:54am<br /><br /><p><font size="3" face="Times New Roman"></font><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">As an update, this is what I have done to make itwork, but I'd still love to know if there is another way to do this and I'mbarking up the wrong tree ...<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">So when my application starts, each module willlook in my database store to find if there are any formats registered againstentity properties in their namespace. For each entity and property, a method iscalled on my base entity (the one all IdeaBlade entities inherit from). <span style="mso-spacerun: yes;">&nbsp;&nbsp;</span>This method saves the property name andformat required in a dictionary, and once per entity only adds a propertyinterceptor action for the whole entity.<span style="mso-spacerun: yes;">&nbsp;</span>Then finally when a property on the entity is set, the action is calledand it loops through the dictionary and adds verifiers for each of theproperties that need formats.<span style="mso-spacerun: yes;">&nbsp; </span>Then theproperty interceptor action is removed.<o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">Here is example code:<span style="mso-spacerun: yes;">&nbsp; </span>This would be called from Module.Initialize()(hard-coded values for example purposes only)</span></p><p style="margin: 0.75pt 1.5pt; line-height: normal;" ="Ms&#111;normal"><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">EntityBase</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">entity = (</span><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">EntityBase</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">)</span><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">Type</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">.GetType(</span><span style='color: rgb163, 21, 21; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">"Courier"</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">).GetConstructor(</span><span style='color: blue; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">new</span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">Type</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">&#091;0&#093;{ }).Invoke(</span><span style='color: blue; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">newobject</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">&#091;0&#093; { });</span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">entity.RegisterPropertyInterceptor(</span><span style='color: rgb163, 21, 21; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">"Code"</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">,</span><span style='color: rgb163, 21, 21; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">"^&#091;0-9&#093;{4}$"</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">);</span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">entity.RegisterPropertyInterceptor(</span><span style='color: rgb163, 21, 21; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">"AccountNumber"</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">,</span><span style='color: rgb163, 21, 21; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">"^&#091;A-Z&#093;{3}&#091;-&#093;&#091;0-9&#093;{2}$"</span><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">);</span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: C&#111;nsolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN"><o:p></o:p></span>&nbsp;</p><p style="margin: 0cm 1.5pt 0pt; line-height: normal; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">Then this isinside my EntityBase class:<o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">#region</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> Property Formatting</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">private</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: rgb43, 145, 175;">Dictionary</span>&lt;<span style="color: blue;">string</span>, <span style="color: rgb43, 145, 175;">PropertyFormatting</span>&gt;propertyFormatInterceptorList = <span style="color: blue;">new</span> <span style="color: rgb43, 145, 175;">Dictionary</span>&lt;<span style="color: blue;">string</span>,<span style="color: rgb43, 145, 175;">PropertyFormatting</span>&gt;();</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><span style="mso-tab-count: 2;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">internal</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: rgb43, 145, 175;">PropertyFormatting</span></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">private</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">readonly</span> <span style="color: blue;">string</span> format;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">private</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">readonly</span> <span style="color: blue;">string</span> formatMessage;<span style="mso-tab-count: 3;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">internal</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> PropertyFormatting(<span style="color: blue;">string</span>format, <span style="color: blue;">string</span> formatMessage, <span style="color: blue;">bool</span> verifierIsLoaded)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">this</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.format = format;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">this</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.formatMessage = formatMessage;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">internal</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">string</span> Format { <span style="color: blue;">get</span> { <span style="color: blue;">return</span> <span style="color: blue;">this</span>.format; } }</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">internal</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">string</span>FormatMessage { <span style="color: blue;">get</span> { <span style="color: blue;">return</span><span style="color: blue;">this</span>.formatMessage; } }</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><span style="mso-tab-count: 2;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">public</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">void</span>RegisterFormatPropertyInterceptor(<span style="color: blue;">string</span>propertyName, <span style="color: blue;">string</span> format, <span style="color: blue;">string</span> formatMessage)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">string</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> entityPropertyInterceptorKey = <span style="color: rgb43, 145, 175;">String</span>.Format(<span style="color: rgb163, 21, 21;">"{0}"</span>,<span style="color: blue;">this</span>.EntityAspect.Entity.ToString());</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">if</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">(!propertyFormatInterceptorList.ContainsKey(propertyName))</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">if</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> (<span style="color: blue;">this</span>.EntityAspect.EntityMetadata.EntityProperties.Where(ep=&gt; ep.Name == propertyName).FirstOrDefault() != <span style="color: blue;">null</span>)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">propertyFormatInterceptorList.Add(propertyName, <span style="color: blue;">new</span> <span style="color: rgb43, 145, 175;">PropertyFormatting</span>(format,formatMessage, <span style="color: blue;">false</span>));<span style="mso-tab-count: 1;">&nbsp;</span><span style="mso-tab-count: 4;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">List</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorAction</span>&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;&gt;actions = <span style="color: rgb43, 145, 175;">PropertyInterceptorManager</span>.CurrentInstance</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.GetActions&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;(<span style="color: blue;">this</span>.GetType(), <span style="color: blue;">null</span>,<span style="color: rgb43, 145, 175;">PropertyInterceptorMode</span>.BeforeSet)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.ToList();</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">if</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> (actions.Where(a =&gt; a.Key ==entityPropertyInterceptorKey).FirstOrDefault() == <span style="color: blue;">null</span>)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">PropertyInterceptorManager</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.CurrentInstance.AddAction(</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">new</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: rgb43, 145, 175;">PropertyInterceptorAction</span>&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;(</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">this</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.GetType(),</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">null</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">,</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">PropertyInterceptorMode</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.BeforeSet,</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">new</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: rgb43, 145, 175;">Action</span>&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;(PropertyFormatInterceptor),</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">0.0,</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">entityPropertyInterceptorKey));</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}<o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p>&nbsp;</o:p></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">public</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> <span style="color: blue;">void</span>PropertyFormatInterceptor(<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;args)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">if</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> (args.Instance.EntityAspect.EntityManager != <span style="color: blue;">null</span> &amp;&amp;args.Instance.EntityAspect.EntityManager.VerifierEngine != <span style="color: blue;">null</span>)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: green; font-family: C&#111;nsolas; font-size: 9.5pt;">// This should only be called once</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">foreach</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> (<span style="color: blue;">var</span>propertyFormatter <span style="color: blue;">in</span> <span style="color: blue;">this</span>.propertyFormatInterceptorList)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">PropertyFormatting</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> propertyFormatting =propertyFormatter.Value;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">Verifier</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> formatVerifier = <span style="color: blue;">new</span> <span style="color: rgb43, 145, 175;">RegexVerifier</span>(<span style="color: blue;">this</span>.GetType(), propertyFormatter.Key, <span style="color: blue;">true</span>, <span style="color: blue;">new</span> <span style="color: rgb43, 145, 175;">NamedRegexPattern</span>(propertyFormatting.FormatMessage,propertyFormatting.Format));</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">formatVerifier.VerifierOptions.ShouldExitOnBeforeSetError= <span style="color: blue;">true</span>;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">formatVerifier.VerifierOptions.ExecutionModes =IdeaBlade.Validation.<span style="color: rgb43, 145, 175;">VerifierExecutionModes</span>.InstanceAndOnBeforeSetTriggers;</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">args.Instance.EntityAspect.EntityManager.VerifierEngine.AddVerifier(formatVerifier);</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</p><div></div><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"></span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">string</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> entityPropertyInterceptorKey = <span style="color: rgb43, 145, 175;">String</span>.Format(<span style="color: rgb163, 21, 21;">"{0}"</span>,args.Instance.EntityAspect.Entity.ToString());</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">List</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorAction</span>&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;&gt;actions = <span style="color: rgb43, 145, 175;">PropertyInterceptorManager</span>.CurrentInstance</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.GetActions&lt;<span style="color: rgb43, 145, 175;">PropertyInterceptorArgs</span>&lt;<span style="color: rgb43, 145, 175;">Entity</span>, <span style="color: rgb43, 145, 175;">Object</span>&gt;&gt;(<span style="color: blue;">this</span>.GetType(), <span style="color: blue;">null</span>,<span style="color: rgb43, 145, 175;">PropertyInterceptorMode</span>.BeforeSet)</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.ToList();</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">foreach</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"> (<span style="color: blue;">var</span> action <span style="color: blue;">in</span> actions.Where(a =&gt; a.Key ==entityPropertyInterceptorKey))</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 9.5pt;">PropertyInterceptorManager</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">.CurrentInstance.RemoveAction(action);</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}</span></p><p style="margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}<o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">#endregion<o:p></o:p></span></p><p><font size="3" face="Times New Roman"></font><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">I have one finalproblem now, but it's to do with the UI (WPF) not IdeaBlade.<span style="mso-spacerun: yes;">&nbsp; </span>The problem is that a UI textbox is bound tothe entity property.<span style="mso-spacerun: yes;">&nbsp; </span>Now I have the UItext box go red and the tooltip show the validation error message when the usertypes in the wrong thing, BUT the UI will still display what the user has typedin even though the actual entity property is something else.<span style="mso-spacerun: yes;">&nbsp; </span>So if anyone has any answers for this thatwould also be a help :)</p><div></span><span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-fareast-: EN-ZA; mso-ansi-: EN;' lang="EN">thanks</span></div>]]>
   </description>
   <pubDate>Thu, 05 Apr 2012 04:54:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13238#13238</guid>
  </item> 
  <item>
   <title>Dynamic verification :   I am trying to add regular...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13234#13234</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1431" rel="nofollow">jeanb</a><br /><strong>Subject:</strong> 3376<br /><strong>Posted:</strong> 05-Apr-2012 at 3:02am<br /><br />I am trying to add regular expression verification to some of my entity properties depending on whether they've been given a regular expression pattern to match by the users.&nbsp; In other word, a user can decide that they want to make an employee code that is 4 digits long "^&#091;0-9&#093;{4}$", and that they want a supplier code to be 3 uppercase - 2 digits "^&#091;A-Z&#093;{3}&#091;-&#093;&#091;0-9&#093;{2}$".<div>&nbsp;</div><div>One problem to overcome is that I need to dynamically add this verification to the entities at runtime.</div><div>&nbsp;</div><div>I have been able to dynamically register property interceptors against the required entities so that I can access their BeforeSet or AfterSet.&nbsp; I have managed to get this working fine.&nbsp; But the problem is, this is only going to be called when the actual properties are set.&nbsp; I cannot access this code from normal verification (so I can't check it before saving, or get property validation errors to my UI controls, etc).</div><div>&nbsp;</div><div>It seems that my only options for verifications are discovery which I cannot add to at runtime, or to use VerifierEngine.Add(verifier).&nbsp; My problem with VerifierEngine.Add(verifier) is that it is associated with an entity manager.&nbsp; My application has many workspaces each with their own entity manager, so basically if I use this method then every time an entity manager is created I would have to add any possible format verifications to that entity manager.&nbsp; This seems a bit heavy handed.</div><div>&nbsp;</div><div>Does anybody have any suggestions for how to go about this?</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 05 Apr 2012 03:02:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3376&amp;PID=13234#13234</guid>
  </item> 
 </channel>
</rss>