<?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 : StringLengthVerifier no longer throw exception for empty string</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : StringLengthVerifier no longer throw exception for empty string</description>
  <pubDate>Wed, 13 May 2026 04:52:46 -700</pubDate>
  <lastBuildDate>Mon, 11 Jun 2012 20:59:37 -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=3482</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>StringLengthVerifier no longer throw exception for empty string : Thanks DenisK,it&amp;#039;s clear...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13815#13815</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=417" rel="nofollow">afrizal.chen</a><br /><strong>Subject:</strong> 3482<br /><strong>Posted:</strong> 11-Jun-2012 at 8:59pm<br /><br />Thanks DenisK,<div>it's clear to me now.</div>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 20:59:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13815#13815</guid>
  </item> 
  <item>
   <title>StringLengthVerifier no longer throw exception for empty string : Hi Afrizal,That is correct. I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13791#13791</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> 3482<br /><strong>Posted:</strong> 07-Jun-2012 at 12:48pm<br /><br />Hi Afrizal,<div><br></div><div>That is correct. I just realized you're expecting an exception but by default, the ErrorNotificationMode is Notify, which causes notification through the INotifyDataErrorInfo and IDataErrorInfo interfaces for binding purposes.</div><div><br></div><div>You can change this mode to Exception if you're expecting it throw an exception. See code sample below.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>&nbsp; &nbsp; &#091;TestMethod&#093;</div><div>&nbsp; &nbsp; public void VerifierEmptyOrNullString() {</div><div>&nbsp; &nbsp; &nbsp; var emp = new Employee();</div><div>&nbsp; &nbsp; &nbsp; _em1.AddEntity(emp);</div><div>&nbsp; &nbsp; &nbsp; _em1.VerifierEngine.DefaultVerifierOptions.ShouldTreatEmptyStringAsNull = true;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; //Set VerifierEngine to throw exception</div><div>&nbsp; &nbsp; &nbsp; _em1.VerifierEngine.DefaultVerifierOptions.ErrorNotificationMode = VerifierErrorNotificationMode.ThrowException;</div><div>&nbsp; &nbsp; &nbsp; try {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; emp.FirstName = String.Empty;</div><div>&nbsp; &nbsp; &nbsp; } catch (Exception ex) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; Assert.IsTrue(ex.Message.Contains("required"));</div><div>&nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; //Default is Notify</div><div>&nbsp; &nbsp; &nbsp; _em1.VerifierEngine.DefaultVerifierOptions.ErrorNotificationMode = VerifierErrorNotificationMode.Notify;</div><div>&nbsp; &nbsp; &nbsp; emp.FirstName = String.Empty;</div><div>&nbsp; &nbsp; &nbsp; Assert.IsTrue(emp.EntityAspect.ValidationErrors.Any(vr =&gt; vr.Message.Contains("required")));</div><div>&nbsp; &nbsp; }</div></div><div></pre></td></tr></table></div><div><br></div><div>Learn more about ErrorNotificationMode here.&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/validati&#111;n-c&#111;nfigure#HErrorNotificati&#111;nMode" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/validation-configure#HErrorNotificationMode</a></div>]]>
   </description>
   <pubDate>Thu, 07 Jun 2012 12:48:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13791#13791</guid>
  </item> 
  <item>
   <title>StringLengthVerifier no longer throw exception for empty string : Hi DenisK,It&amp;#039;s on the client...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13776#13776</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=417" rel="nofollow">afrizal.chen</a><br /><strong>Subject:</strong> 3482<br /><strong>Posted:</strong> 06-Jun-2012 at 5:53pm<br /><br />Hi DenisK,<div>It's on the client side.</div><div>Isn't the default value for&nbsp;<span style=": rgb251, 251, 253; text-align: left; ">ShouldTreatEmptyStringAsNull</span><span style=": rgb251, 251, 253; text-align: left; ">&nbsp; is true?</span></div><div><span style=": rgb251, 251, 253; text-align: left; ">As i do not change its value, it shall stays as true, and I would expect to get the exception when the property is set to string.empty.</span></div>]]>
   </description>
   <pubDate>Wed, 06 Jun 2012 17:53:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13776#13776</guid>
  </item> 
  <item>
   <title>StringLengthVerifier no longer throw exception for empty string : Hi Afrizal,Where do you expect...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13775#13775</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> 3482<br /><strong>Posted:</strong> 06-Jun-2012 at 5:33pm<br /><br />Hi Afrizal,<div><br></div><div>Where do you expect to see the exception thrown? On the client or server?</div><div><br></div><div>Remember that the EntityManager and EntityManager.VerifierEngine are both different instance on the client and server. So make sure you're setting the ShouldTreatEmptyStringAsNull flag on both client and server.</div><div><br></div><div>A typical place to set this on server is in your custom SaveInterceptor.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>public class SaveInterceptor : EntityServerSaveInterceptor {</div><div>&nbsp; &nbsp; &nbsp; protected override bool ValidateSave() {</div><div>&nbsp; &nbsp; &nbsp; EntityManager.VerifierEngine.DefaultVerifierOptions.ShouldTreatEmptyStringAsNull = false;</div><div>&nbsp; &nbsp; &nbsp; return base.ValidateSave();</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div></div><div></pre></td></tr></table></div>]]>
   </description>
   <pubDate>Wed, 06 Jun 2012 17:33:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13775#13775</guid>
  </item> 
  <item>
   <title>StringLengthVerifier no longer throw exception for empty string : I have many properties with such...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13754#13754</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=417" rel="nofollow">afrizal.chen</a><br /><strong>Subject:</strong> 3482<br /><strong>Posted:</strong> 06-Jun-2012 at 1:42am<br /><br /><div>I have many properties with such attribute below:</div>&#091;IbVal.StringLengthVerifier(MaxValue=150, IsRequired=true, ErrorMessageResourceName="Party_ID")&#093;<div><br></div><div>When I set Party.ID = string.empty; it's no longer throwing "ID is required" exception.</div><div>I also check my&nbsp;<em style="text-align: left; : rgb251, 251, 253; ">EntityManager.VerifierEngine.DefaultVerifierOptions.ShouldTreatEmptyStringAsNull, the value is true.</em></div><div><em style="text-align: left; : rgb251, 251, 253; "><br></em></div><div><em style="text-align: left; : rgb251, 251, 253; ">With these settings, I would expect to receive an exception when Party.ID is set to string.empty.</em></div><div><em style="text-align: left; : rgb251, 251, 253; ">And I have many code depending on this feature.</em></div>]]>
   </description>
   <pubDate>Wed, 06 Jun 2012 01:42:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3482&amp;PID=13754#13754</guid>
  </item> 
 </channel>
</rss>