<?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 : DF2010-SL FK constraint validation</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : DF2010-SL FK constraint validation</description>
  <pubDate>Sat, 27 Jun 2026 11:13:08 -700</pubDate>
  <lastBuildDate>Wed, 06 Feb 2013 10:23:10 -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=3971</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>DF2010-SL FK constraint validation : Thanks for the elaborate post.  I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15820#15820</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 06-Feb-2013 at 10:23am<br /><br />Thanks for the elaborate post.<DIV>&nbsp;</DIV><DIV>I was able to do a similar thing.</DIV><DIV>We are code-second, so I introduced a buddy class for the auto generated entity class and had it implement IValidate with one method: Validate(<SPAN style="COLOR: #2b91af">VerifierResultCollection</SPAN>&nbsp;validationErrors)</DIV><DIV>With this in mind and the binding being in a valid state, I checked if the _id properties = 0, and then followed your example.</DIV><DIV>Validation worked as advertised and we found some problems with our style/controls too :)</DIV><DIV>&nbsp;</DIV><DIV>Again,&nbsp;many thanks.</DIV>]]>
   </description>
   <pubDate>Wed, 06 Feb 2013 10:23:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15820#15820</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation : I just realized that you can actually...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15787#15787</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 04-Feb-2013 at 7:51am<br /><br />I just realized that you can actually force the State validation. Click Add, enter first/last name in the popup, click ok and then immediately hit Save without entering anything else. You'll see the error popup I described above with all the validation errors including the missing State. It doesn't currently display the red box around the drop down, though, because the styling is wrong.&nbsp;]]>
   </description>
   <pubDate>Mon, 04 Feb 2013 07:51:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15787#15787</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation : You can actually find this very...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15785#15785</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 04-Feb-2013 at 7:41am<br /><br />You can actually find this very example in TempHire.<div><br></div><div>https://github.com/IdeaBlade/Cocktail/blob/master/Samples/TempHire/DomainModel/Address.cs</div><div><br></div><div>See the Validate method at the bottom. The method is called by the EntityManagerDelegate during a save and if validation errors occur, Cocktail automatically cancels the save and notifies the UI as documented (see above link).</div><div><br></div><div>https://github.com/IdeaBlade/Cocktail/blob/master/Samples/TempHire/TempHire/EntityManagerDelegate.cs</div><div><br></div><div>You can't force this particular validation in TempHire at the moment, because the way the current combobox is bound, the State property is always set to a valid state. You can see other validation rules in action, though by not filling in the zipcode for example. The validation rules for the zip code are specified using validation attributes on the property. Cocktail automatically executes all validation rules before allowing the save to proceed.&nbsp;</div><div><br></div><div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font-family: C&#111;nsolas, 'Liberati&#111;n Mono', Courier, monospace; color: rgb51, 51, 51;"><div ="line" id="LC61" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">        &#091;DataMember&#093;</span></div><div ="line" id="LC62" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">        &#091;Required&#093;</span></div><div ="line" id="LC63" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">        &#091;StringLength(10, MinimumLength = 5)&#093;</span></div><div ="line" id="LC64" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">public</span> <span ="kt" style="margin: 0px; padding: 0px; border: 0px; color: rgb68, 85, 136; font-weight: bold;">string</span> <span ="n" style="margin: 0px; padding: 0px; border: 0px;">Zipcode</span> <span ="p" style="margin: 0px; padding: 0px; border: 0px;">{</span> <span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">get</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">;</span> <span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">set</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">;</span> <span ="p" style="margin: 0px; padding: 0px; border: 0px;">}</span></div></pre></div><div><br></div><div>Besides the red boxes on the UI in case of a validation error, TempHire also reacts to validation errors by displaying an error popup. It does this by implementing IValidationErrorNotification, which in turn simply publishes a message to the EventAggregator.</div><div><br></div><div>https://github.com/IdeaBlade/Cocktail/blob/master/Samples/TempHire/Common/Validation/ValidationErrorHandler.cs</div><div><br></div><div>The message is then processed by the ValidationErrorMessageProcessor, which displays the error popup.</div><div><br></div><div>https://github.com/IdeaBlade/Cocktail/blob/master/Samples/TempHire/Common/Validation/ValidationErrorMessageProcessor.cs</div><div><br></div>]]>
   </description>
   <pubDate>Mon, 04 Feb 2013 07:41:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15785#15785</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation : BTW I saw my previous post on...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15784#15784</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 04-Feb-2013 at 7:35am<br /><br />BTW I saw my previous post on this topic and the where question has been solved, now I remember it again :)<br /><br />The question is that if I will simply throw a ValidationError exception, this will be shown via the I notifydataerrorinfo infra?<br /><br />The example here shows that the service returns ok/not ok, but it's not clear to me how this error is communicated further on...<span style="font-size:10px"><br /><br />Edited by siko - 04-Feb-2013 at 7:36am</span>]]>
   </description>
   <pubDate>Mon, 04 Feb 2013 07:35:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15784#15784</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation : I have found it difficult to understand...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15783#15783</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 04-Feb-2013 at 7:13am<br /><br />I have found it difficult to understand where to place the validation logic in our solution, which follows the model/services/view model design like in the TempHire reference app.<br /><br />How would I check for foreign key constraints?<br /><br />My person entity has a location.<br /><br />Person entity is exposed via a prop on the viewmodel and the list of locations are bound to a combobox which selected item is bound to the location property of the person entity? <br />How should I check that the location property on person has not been set?<br /><br />A simple (cocktail) example would help a great deal!<span style="font-size:10px"><br /><br />Edited by siko - 04-Feb-2013 at 7:14am</span>]]>
   </description>
   <pubDate>Mon, 04 Feb 2013 07:13:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15783#15783</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation :   IMO you should only ever get...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15777#15777</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 03-Feb-2013 at 12:16pm<br /><br />IMO you should only ever get such an error if you have a bug in your application. Your application should have validation logic to not even allow the user to save if it would result in a foreign key constraint error. That's the whole point of validation to ensure your entities are valid and have the necessary data integretity to be persisted to the database. Validation errors will be piped through to the UI via INotifyDataErrorInfo. <div>&nbsp;</div><div>To learn more about how to implement validation logic, see the following links.</div><div>&nbsp;</div><div><a href="http://drc.ideablade.com/devforce-2012/bin/view/&#068;ocumentati&#111;n/validate" target="_blank">http://drc.ideablade.com/devforce-2012/bin/view/Documentation/validate</a></div><div>&nbsp;</div><div><a href="http://drc.ideablade.com/devforce-2012/bin/view/&#068;ocumentati&#111;n/cocktail-validati&#111;n" target="_blank">http://drc.ideablade.com/devforce-2012/bin/view/Documentation/cocktail-validation</a></div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Sun, 03 Feb 2013 12:16:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15777#15777</guid>
  </item> 
  <item>
   <title>DF2010-SL FK constraint validation : Hi, How can we: - Change the  &amp;#039;The...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15775#15775</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3971<br /><strong>Posted:</strong> 03-Feb-2013 at 8:01am<br /><br />Hi,<br />How can we:<br />- Change the <br />'The INSERT statement conflicted with the FOREIGN KEY constraint “FK_xxx. The conflict occurred in database “yyy’, table zzz, column www. The statement has been terminated.' <br />message into some more user readable<br />- set the more user friendly error info on the UI via INotifyDataErrorInfo?<br /><br />Thanks.]]>
   </description>
   <pubDate>Sun, 03 Feb 2013 08:01:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3971&amp;PID=15775#15775</guid>
  </item> 
 </channel>
</rss>