<?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 : Property Uniqueness?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Property Uniqueness?</description>
  <pubDate>Wed, 13 May 2026 01:03:02 -700</pubDate>
  <lastBuildDate>Mon, 10 Sep 2012 14:14:55 -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=3617</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>Property Uniqueness? : Thank you both for your quick...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14391#14391</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1181" rel="nofollow">jradxl</a><br /><strong>Subject:</strong> 3617<br /><strong>Posted:</strong> 10-Sep-2012 at 2:14pm<br /><br />Thank you both for your quick and full responses.<br>Informing the User and a responsive application is indeed my goal, and so this is very useful. Indeed async operation in a WPF app was not something I had immediately thought of.<br>Thanks<br>John<br>]]>
   </description>
   <pubDate>Mon, 10 Sep 2012 14:14:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14391#14391</guid>
  </item> 
  <item>
   <title>Property Uniqueness? : John, Checking uniqueness takes...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14390#14390</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> 3617<br /><strong>Posted:</strong> 10-Sep-2012 at 1:15pm<br /><br />John,<DIV>Checking uniqueness takes a little bit more thought than simply putting a uniquness constraint on the property, unless you are perfectly happy with an exception if you are trying to save a duplicate. If that's the case, then stop reading. If you however want to alert the user before it hits the database, then read on.</DIV><DIV>&nbsp;</DIV><DIV>Checking if a property is unique requires querying the DB. In Silverlight that is an asynchronous operation. In WPF it should be an asynchronous operation if you want a good performing application. The proper approach is a validation service that the ViewModel can asynchronously call before saving the data. There's still the possiblity that you get a constraint violation in the DB if an other user snuck in a save between you checking for uniquness and saving the data, so you should still have a DB constraint. </DIV><DIV>&nbsp;</DIV><DIV>You can find more information and an example here:</DIV><DIV>&nbsp;</DIV><DIV><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/unit-of-work-pattern-and-persistence-ignorance#HDomainService" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance#HDomainService</A></DIV>]]>
   </description>
   <pubDate>Mon, 10 Sep 2012 13:15:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14390#14390</guid>
  </item> 
  <item>
   <title>Property Uniqueness? :    DevForce is relying on the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14387#14387</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3617<br /><strong>Posted:</strong> 10-Sep-2012 at 10:52am<br /><br />DevForce is relying on the EF Code First attributes (or Fluent API) to define the model, and right now EF does not support unique keys.&nbsp; There are a couple of options though.<div>&nbsp;</div><div>To add a unique constraint or index to the database table you can write a custom DbInitializer and create the index within the Seed method logic, or as of EF 4.3 use Db migrations.&nbsp;&nbsp; Here's some more information from StackOverflow - <a href="http://stackoverflow.com/questi&#111;ns/4413084/unique-c&#111;nstraint-in-entity-framework-code-first" target="_blank">http://stackoverflow.com/questions/4413084/unique-constraint-in-entity-framework-code-first</a>&nbsp;and <a href="http://stackoverflow.com/questi&#111;ns/8262590/entity-framework-code-first-fluent-api-adding-indexes-to-columns" target="_blank">http://stackoverflow.com/questions/8262590/entity-framework-code-first-fluent-api-adding-indexes-to-columns</a>.</div><div>&nbsp;</div><div>You can also write a custom DevForce verifier to validate the property when it's set or the entity is saved - <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/validati&#111;n-create-custom-verifier" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/validation-create-custom-verifier</a>.</div>]]>
   </description>
   <pubDate>Mon, 10 Sep 2012 10:52:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14387#14387</guid>
  </item> 
  <item>
   <title>Property Uniqueness? : Hi,If a property needs to be unique...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14383#14383</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1181" rel="nofollow">jradxl</a><br /><strong>Subject:</strong> 3617<br /><strong>Posted:</strong> 10-Sep-2012 at 8:53am<br /><br />Hi,<br>If a property needs to be unique (such as UserName or EmailAddress) but not a primary key how does one go about adding it in Code First?<br>Is there an Attribute?<br>OK, the UI can inforce it, but is there a Devforce database compatible way?<br>thanks<br>John<br><br>]]>
   </description>
   <pubDate>Mon, 10 Sep 2012 08:53:53 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3617&amp;PID=14383#14383</guid>
  </item> 
 </channel>
</rss>