<?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 : Checking an entity for errors</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Checking an entity for errors</description>
  <pubDate>Wed, 10 Jun 2026 17:28:34 -700</pubDate>
  <lastBuildDate>Wed, 01 Sep 2010 19:02:02 -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=1941</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>Checking an entity for errors : Since the PrimaryOfficeID is non-nullable,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=8320#8320</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1941<br /><strong>Posted:</strong> 01-Sep-2010 at 7:02pm<br /><br /><P>Since the PrimaryOfficeID is non-nullable, it has to be assigned a default value on creation.&nbsp; There is no required entity / foreign key validator in .NET or DevForce (perhaps we should create one), and the required field validator doesn't apply because the field is non-nullable.&nbsp; So, there is nothing to say that the default value fails a verification check.</P><P>You can create an instance verifier on Employee that makes sure that:<BR>&nbsp; this.PrimaryOffice.EntityAspect.IsNullEntity == false</P><DIV>You can also create it as a property verifier on Employee.PrimaryOffice that does the same thing.</DIV><P>Here's the link to&nbsp;read about verification and see some samples:</P><DIV><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/Topic_Validati&#111;n" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/Topic_Validation</A></DIV><P>If you have trouble, we can have someone write up a quick example.<BR></P><span style="font-size:10px"><br /><br />Edited by ting - 01-Sep-2010 at 7:04pm</span>]]>
   </description>
   <pubDate>Wed, 01 Sep 2010 19:02:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=8320#8320</guid>
  </item> 
  <item>
   <title>Checking an entity for errors : I have the following scenario...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=8302#8302</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=923" rel="nofollow">jwooten</a><br /><strong>Subject:</strong> 1941<br /><strong>Posted:</strong> 31-Aug-2010 at 3:31pm<br /><br /><DIV>I have the following scenario in a Silverlight 4 application using DevForce 2010...</DIV><DIV>&nbsp;</DIV><DIV>I have&nbsp;2 entities, say "Employee" and "Office"...&nbsp; And "Employee" table has non-nullable column "PrimaryOfficeID" with&nbsp;foreign key relation to&nbsp;"OfficeID" column in "Office" table....</DIV><DIV>&nbsp;</DIV><DIV>When I create new "Employee" entity in the application and then save it <strong>without assigning it a primary office</strong>...&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>Why&nbsp;might it be that&nbsp;upon saving the new Employee entity that the result of executing verification on that entity (as shown above) does not reflect an error?</DIV><DIV>&nbsp;</DIV><DIV>I assume this is because the PrimaryOffice property contains a null Office entity which is valid.&nbsp; Is that correct?</DIV><DIV>&nbsp;</DIV><DIV>If so,&nbsp;how&nbsp;do I make it so that attempting the save without assigning a primary office would&nbsp;cause this verification to fail?&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 31 Aug 2010 15:31:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=8302#8302</guid>
  </item> 
  <item>
   <title>Checking an entity for errors : Thank you for clearing that up...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7547#7547</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=587" rel="nofollow">cjohnson84</a><br /><strong>Subject:</strong> 1941<br /><strong>Posted:</strong> 07-Jul-2010 at 11:24am<br /><br />Thank you for clearing that up for me Greg!]]>
   </description>
   <pubDate>Wed, 07 Jul 2010 11:24:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7547#7547</guid>
  </item> 
  <item>
   <title>Checking an entity for errors : DevForce automatically runs instance...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7532#7532</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> 1941<br /><strong>Posted:</strong> 06-Jul-2010 at 6:00pm<br /><br />DevForce automatically runs instance verification, server-side, against all entities submitted for a save. <br /><br />If you want to check client-side, you can do so in an EntityManager.Saving handler. In that, you have access to the collection of entities being saved, and can simply order instance verification against each.<br /><br /><table width="99%"><tr><td><pre class="BBcode"><br />_em1.Saving += new EventHandler&lt;EntitySavingEventArgs&gt;(_em1_Saving);<br />_em1.ExecuteQueryAsync&lt;Customer&gt;(customersQuery, GotCustomers, null);<br /><br />...<br /><br />void _em1_Saving(object sender, EntitySavingEventArgs e) {<br />  foreach (Entity anEntity in e.Entities) {<br />&nbsp;&nbsp;&nbsp;&nbsp;anEntity.EntityAspect.EntityManager.VerifierEngine.Execute(anEntity);<br />  }<br />}</pre></td></tr></table><br /><br />If any instance verification returns a VerifierResult that indicates a problem, you just set the Cancel property of the EntitySavingEventArgs object to true, and the save won't be submitted.<br /><span style="font-size:10px"><br /><br />Edited by GregD - 06-Jul-2010 at 6:02pm</span>]]>
   </description>
   <pubDate>Tue, 06 Jul 2010 18:00:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7532#7532</guid>
  </item> 
  <item>
   <title>Checking an entity for errors : I have bound an observable collection...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7519#7519</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=587" rel="nofollow">cjohnson84</a><br /><strong>Subject:</strong> 1941<br /><strong>Posted:</strong> 06-Jul-2010 at 6:06am<br /><br />I have bound an observable collection of entities retrieved from my database via my DevForce 2010 data model to a ComponentOne DataGrid.&nbsp; I have the "Validation Attribute Mode" set to "DotNetValidation" in my data model.&nbsp; This has allowed me to get validation working with the validation built into the grid.<DIV>&nbsp;</DIV><DIV>When I edit the collection bound to the grid I see the validation errors.&nbsp; We are allowing the users to modify the contents of the grid and then click a Save button which will commit the changes back to the database.</DIV><DIV>&nbsp;</DIV><DIV>The issue I'm having is if the user clicks the Save button and validation errors exist (they are displayed visually)&nbsp;how&nbsp;do I check for the validation errors and not allow the commit operation?</DIV><DIV>&nbsp;</DIV><DIV>I was thinking I could loop through the observable collection and check each entity to see if it has errors since ultimately the Entities inherit from INotifyDataErroInfo (in the EntityWrapper class).&nbsp; I can't seem to find the implementation of the HasErrors property though and where this property of the interface is exposed.</DIV><DIV>&nbsp;</DIV><DIV>I guess ultimately then my question is how do I check to see if an entity "HasErrors"?</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 06 Jul 2010 06:06:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1941&amp;PID=7519#7519</guid>
  </item> 
 </channel>
</rss>