<?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 : Validation Problem</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Validation Problem</description>
  <pubDate>Wed, 15 Apr 2026 17:45:39 -700</pubDate>
  <lastBuildDate>Wed, 26 Jun 2013 12:47:45 -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=4191</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>Validation Problem : Mariusk,The sample is rather simple...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4191&amp;PID=16487#16487</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 4191<br /><strong>Posted:</strong> 26-Jun-2013 at 12:47pm<br /><br />Mariusk,<div><br></div><div>The sample is rather simple and just gives you an idea of how validation works.</div><div>Obviously, you can always add complexity to it.</div><div><br></div><div>The validation on the sample is meant to happen to existing records in case you modify them with invalid data.&nbsp;</div><div>i.e. load one of the records and delete the FirstName value; as soon as you tab off the field, the validation will occur and complain about the problem (null value).</div><div><br></div><div>If you want to avoid the exception when you call SaveChanges on a newly created entity that hasn't had its values assigned, simply add some checking before save:</div><div><br></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px;"><span style="color: blue;">public</span>&nbsp;<span style="color: blue;">void</span>&nbsp;Save()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">var</span>&nbsp;result&nbsp;=&nbsp;_mgr.VerifierEngine.Execute(_currentEmployee);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">if</span>&nbsp;(!result.HasErrors)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_mgr.SaveChanges();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: blue;">else</span>&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb43, 145, 175;">MessageBox</span>.Show(result.Errors.First().Message);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</pre></div><div>N<span style="line-height: 1.4;">otice that now the SaveChanges call won't occur unless all entities to be saved conform with validation rules. Also, if you navigate among the entities, you will notice that the required field in the new entity (i.e. First and LastName) will have the exclamation mark.</span></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Wed, 26 Jun 2013 12:47:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4191&amp;PID=16487#16487</guid>
  </item> 
  <item>
   <title>Validation Problem : I am very new in starting out...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4191&amp;PID=16477#16477</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=2070" rel="nofollow">mariusk</a><br /><strong>Subject:</strong> 4191<br /><strong>Posted:</strong> 23-Jun-2013 at 2:07am<br /><br />I am very new in starting out in with devforce. I am busy going through the validation code samples situated at&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/code-sample-validati&#111;n-wpf" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-validation-wpf</a>.<div><br></div><div><br></div><div>I have downloaded the sample project and configured the connection string to point to my local northwindIB database.</div><div><br></div><div>When I click on the Add button and then directly on OK I expect the First Name textbox to be highlighted in red or to have an exclamation mark next to it as it is an compulsory field.</div><div><br></div><div>It doesn't, it goes all the way through to the save method and then continues to execute&nbsp;_mgr.SaveChanges();</div><div><br></div><div>Then this function throws an "EntityManagerSaveException was unhandled" exception.</div><div><br></div><div>What do I need to add to this sample project to stop it from executing the save method before all the required text boxes have been populated?</div><div><br></div><div>Isn't the purpose of this particular example to show how the validation works???<br><div><br></div><div><br></div><div>It's also called&nbsp;WPF_SimpleValidationCompleted which would indicate to me that I do not need to add extra code to this project for it to show me how the validation features work?</div></div><div><br></div><div>Please help, I just need a working example as to how I can validate a UI connected to an entity framework model.</div><div><br></div><div>Regards</div><div>Marius</div>]]>
   </description>
   <pubDate>Sun, 23 Jun 2013 02:07:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4191&amp;PID=16477#16477</guid>
  </item> 
 </channel>
</rss>