<?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 : Default Values</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Default Values</description>
  <pubDate>Tue, 21 Apr 2026 08:52:10 -700</pubDate>
  <lastBuildDate>Fri, 14 May 2010 22:32: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=1807</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>Default Values : There are a lot of scenarios here...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1807&amp;PID=6890#6890</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> 1807<br /><strong>Posted:</strong> 14-May-2010 at 10:32pm<br /><br />There are a lot of scenarios here so let me try to cover them one by one.<DIV>&nbsp;</DIV><DIV>In general, you specify the default value for the property in the Entity Framework designer, and when the object is created, DevForce will set those properties to their default values.&nbsp; This doesn't solve the problem that the Entity Framework&nbsp;does not get the default&nbsp;from SQL Server, but within DevForce, there should not be a problem where&nbsp;validation fails before the default value is set.</DIV><DIV>&nbsp;</DIV><DIV>Now for the specific cases:</DIV><DIV>&nbsp;</DIV><DIV>If want the server to record the Owner for the record (instead of doing this in the client) you can do this in the EntityServerSaveInterceptor.&nbsp; Here, by overriding ExecuteSave(), you can modify the Order's Owner to the current user just before the save.</DIV><DIV>&nbsp;</DIV><DIV>For primary key fields, DevForce has an IIdGenerator interface that allows the client to create new records with temporary ids and the server will assign them the permanent primary keys just before save.&nbsp;&nbsp;DevForce&nbsp;will then&nbsp;will fixup the object graph to correct all the foreign key references to the permanent&nbsp;primary key value.</DIV><DIV>&nbsp;</DIV><DIV>I believe you may be working with our professional services, so we can go over these patterns in more detail when you're ready to start.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 14 May 2010 22:32:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1807&amp;PID=6890#6890</guid>
  </item> 
  <item>
   <title>Default Values : Hi   How do you support default...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1807&amp;PID=6867#6867</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=749" rel="nofollow">iosub</a><br /><strong>Subject:</strong> 1807<br /><strong>Posted:</strong> 13-May-2010 at 5:13am<br /><br />Hi<DIV>&nbsp;</DIV><DIV><P style="MARGIN: 0cm 1.5pt 0.75pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-ansi-: EN-US" lang=EN-US>How do you support default values&nbsp;for fields? Do you&nbsp;define on the EF model or partial class? </P><DIV>For example:</DIV><DIV>I want&nbsp;that each time I create a new record on "orders" the&nbsp;default value for "Owner" will be the user that has login on the application. So my silverlight app does not have to have the code for the default value and is only defined on the server. So every client that will conect to the server will have the same default value</DIV><DIV>&nbsp;</DIV><DIV>WCF for&nbsp;RIA does not hadled this correctly, it use the Oncreate method that you have to share with the client. This has problems because if I change the Server code, I have to update all my clients. </DIV><DIV>&nbsp;</DIV><DIV>Another problem with&nbsp;EF is that does not get this information from the default value defined on the SQL Server, it does not work if you define the default value on the EF model either, so when you create a new value con the SL client and you have a validation, if the value is emptly&nbsp;the validation fails.. So the only solution is to use "oncreate". </DIV><DIV>&nbsp;</DIV><DIV>I have also try with &lt;DEFAULT&gt; atribute on the metadata but it does not work.. because the validation on SL goes before the &lt;Default&gt;..</DIV><DIV>&nbsp;</DIV><DIV>There is also another problem with Default values on WCF Ria. If the field is a KEY it has the attribute &lt;Requiered&gt; so the default value does not work at all. I have always need to do the Oncreate. Here is a problem, because if I have a KEY Field&nbsp;that has to be calculated (example OrderNumber that is the last Order of the customer+1) I want to calculate this value on the save moment.. If I do it before and the user cancels the order I have emptly orders Numers.. I can't do it on the SQLserver with a trigger because the Validation on the SL client</DIV><DIV>&nbsp;</DIV><DIV>How do you support this on DF??</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Thanks!</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>The good idea</SPAN></DIV><P style="MARGIN: 0.75pt 1.5pt 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P></DIV>]]>
   </description>
   <pubDate>Thu, 13 May 2010 05:13:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1807&amp;PID=6867#6867</guid>
  </item> 
 </channel>
</rss>