<?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 : null for integer doesn&#039;t verify</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : null for integer doesn&#039;t verify</description>
  <pubDate>Thu, 11 Jun 2026 03:11:52 -700</pubDate>
  <lastBuildDate>Thu, 29 May 2008 16:52:56 -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=816</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>null for integer doesn&#039;t verify : DataMan:    In order for a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=816&amp;PID=3003#3003</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 816<br /><strong>Posted:</strong> 29-May-2008 at 4:52pm<br /><br /><DIV><FONT size=2>DataMan:</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>&#091;Sorry for the delay. I attempted to post this&nbsp;on Tuesday, but for whatever reason it doesn't seem to have made it to the forum.&#093;</FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT size=2>In order for a verification error to be diagnosed upon *setting* the SortOrder value, you would need a call to BeforeSetValue() in the SortOrder setter.&nbsp; You </FONT><FONT size=2><FONT size=2>can code the call to BeforeSetValue() yourself in the setter in your SortOrder override, or y</FONT></FONT><FONT size=2>ou can get the Object Mapper to generate it for you (into the base class).</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>To do the latter, open the Verifications Options dialog and select the RadioButton to turn verification code generation On. </FONT><FONT size=2>Having done that, you can still turn off the generation of attributed verifiers by unchecking the "Generate predefined verifiers" CheckBox. You can also turn off the generation of BeforeSetValue() or AfterSetValue() calls, as the default,&nbsp;by selecting "Neither" i</FONT><FONT size=2>n the Property Setter Options area of the dialog</FONT><FONT size=2>. </FONT><FONT size=2>Then, on the Simple Properties tab&nbsp;on the main Object Mapper dialog, you can turn on the generation of that call for the SortOrder property (only).</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>None of above, however, is required to make your instance verification work properly. All that is required for that is (a) to add the attribute to define the verifier (as you have done); and (b) to call instance verification and properly deal with the result.&nbsp; Here's an example of using instance verification on an Employee instance:</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>&nbsp;&nbsp;&nbsp; void mPersMgr_Saving(object sender, EntitySavingEventArgs e) {</FONT></DIV><DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (Entity anEntity in e.Entities) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (anEntity is Employee) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Employee anEmployee = (Employee)anEntity;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VerifierResultCollection aVerifierResultCollection = anEmployee.VerifierEngine.Execute(anEmployee);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (VerifierResult result in aVerifierResultCollection) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!result.IsOk) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show("Employee &#091;" + anEmployee.LastFirst + "&#093; failed verification. Save cancelled.");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Cancel = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>In the above code, if the IsOK property of any VerifierResult returned by the call to VerifierEngine.Execute() is false, the save is cancelled.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Regards,</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Greg Dunn</FONT></DIV><DIV><FONT size=2>IdeaBlade</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 29 May 2008 16:52:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=816&amp;PID=3003#3003</guid>
  </item> 
  <item>
   <title>null for integer doesn&#039;t verify : Setup: The Generate Predefined...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=816&amp;PID=2980#2980</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=90" rel="nofollow">DataMan</a><br /><strong>Subject:</strong> 816<br /><strong>Posted:</strong> 23-May-2008 at 9:30am<br /><br /><DIV><FONT size=5>Setup:</FONT></DIV><DIV><FONT size=2>The Generate Predefined Verifiers option is not enabled</FONT></DIV><DIV><FONT size=2>Sort order does not allow nulls.</FONT></DIV><DIV>SortOrder is overridden with the following:</DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>&#091;Int32RangeVerifier(MinValue = 1, IsRequired = true)&#093;<BR>public override int SortOrder<BR>{<BR>get<BR>{<BR>return base.SortOrder;<BR>}<BR>set<BR>{<BR>base.SortOrder = value;<BR>}<BR>}</FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT size=5>Issue:</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>When I open the form and edit an existing record and erase the value in sort order the error icon flashes and tells me that the sort order must be greater than 1.&nbsp; Which is correct and wonderful.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Then I&nbsp;run the verify code (that I grabbed from your tutorials) on the current record it passes all tests (Which it shouldn't).&nbsp; When I step into the code and look at the value of sortorder in the current record of the BS it is still the old value.&nbsp; This is not so wonderful.&nbsp;&nbsp; </FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>I do notice the following when&nbsp;the code runs an&nbsp;endedit with a null sortorder:&nbsp; <FONT size=1><P>A first chance exception of type 'IdeaBlade.Verification.VerifierResultException' occurred in IdeaBlade.Persistence.dll</FONT></FONT></P></DIV><DIV><FONT size=2>When I remove the line &#091;Int32RangeVerifier(MinValue = 1, IsRequired = true)&#093; from the override&nbsp;the application&nbsp;then doesn't allow me to enter a null value into the field.&nbsp; It automatically replaces it with 0.&nbsp; But then because there is no rule on the MinValue, 0 passes the tests.&nbsp; 0 is an incorrect value.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>So then I think "Well,&nbsp; I'll allow null values in ideablade for the sort order field and see what happens".&nbsp; On new records the record passes the verify test and says that the sort order is required which is great&nbsp;BUT on old records where I change the sort order to&nbsp;blank (null) the&nbsp;null sort order passes the verifier test.&nbsp; Each time I change the value to null on the form I get the first chance exception error as listed above.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>I want to be able to use either the errorproviders or the verifier engine (not both).&nbsp; If the user donesn't actually change the value of a field the error providers for ideablade don't fire and if I use the verifier in the override, it doesn't work properly when null values are entered in for fields that don't allow null.&nbsp; My save method checks to see if there are any errors in the verifiy code and if there are then the save cannot continue.&nbsp; Because the verifier doesn't catch the null value in sort order it is allowing errors into the data.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Suggestions?</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 23 May 2008 09:30:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=816&amp;PID=2980#2980</guid>
  </item> 
 </channel>
</rss>