<?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 : Setting Primay Key values</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Setting Primay Key values</description>
  <pubDate>Thu, 16 Apr 2026 14:52:15 -700</pubDate>
  <lastBuildDate>Tue, 15 Dec 2009 13:59:24 -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=1588</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>Setting Primay Key values : I am not completely sure what...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1588&amp;PID=5944#5944</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1588<br /><strong>Posted:</strong> 15-Dec-2009 at 1:59pm<br /><br /><P>I am not completely sure what you are trying to do, but you may find this trick helpful.&nbsp; Assume emp is an Employe</P><DIV>emp.id = 22</DIV><DIV>&nbsp;</DIV><DIV>gives compiler error.&nbsp; "Property Id is read-only";</DIV><DIV>&nbsp;</DIV><DIV>but</DIV><DIV>&nbsp;</DIV><DIV>emp&#091;"Id"&#093; = 22;</DIV><DIV>&nbsp;</DIV><DIV>compiles and assigns&nbsp;22 to Id property;</DIV><DIV>&nbsp;</DIV><DIV>You can also use:</DIV><DIV>&nbsp;</DIV><DIV>emp&#091;0&#093; = 22;</DIV>]]>
   </description>
   <pubDate>Tue, 15 Dec 2009 13:59:24 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1588&amp;PID=5944#5944</guid>
  </item> 
  <item>
   <title>Setting Primay Key values : The object mapper by default sets...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1588&amp;PID=5942#5942</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=643" rel="nofollow">downeytim</a><br /><strong>Subject:</strong> 1588<br /><strong>Posted:</strong> 15-Dec-2009 at 11:26am<br /><br />The object mapper by default sets all PK fields to ReadOnly. <DIV>&nbsp;</DIV><DIV>In many cases in our application we are passing the values for the PK to the create method on a Business Object class. </DIV><DIV>&nbsp;</DIV><DIV>In the example below ComponentId is the PK of IOComponentOption.&nbsp; How do I set this without changing all the field definitions in the Object Mapper for 500+ business objects?&nbsp; I assume I can use the SetColumnValue method but this is a lot of code to rewrite for almost every business object.</DIV><DIV>&nbsp;</DIV><DIV>EXAMPLE: </DIV><DIV>&nbsp;</DIV><FONT color=#0000ff><FONT color=#0000ff><P><FONT size=2 face="Arial, Helvetica, sans-serif">public</FONT></FONT></FONT><FONT size=2 face="Arial, Helvetica, sans-serif"> <FONT color=#0000ff><FONT color=#0000ff>static</FONT></FONT> <FONT color=#2b91af><FONT color=#2b91af>IOComponentOption</FONT></FONT> <FONT color=#020002><FONT color=#020002>Create</FONT></FONT>(<FONT color=#0000ff><FONT color=#0000ff>int</FONT></FONT> <FONT color=#020002><FONT color=#020002>componentId</FONT></FONT>){</FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#2b91af><FONT color=#2b91af>&nbsp;&nbsp; IOComponentOption</FONT></FONT> <FONT color=#020002><FONT color=#020002>option</FONT></FONT> = <FONT color=#2b91af><FONT color=#2b91af>Session</FONT></FONT>.<FONT color=#020002><FONT color=#020002>PM</FONT></FONT>.<FONT color=#020002><FONT color=#020002>CreateEntity</FONT></FONT>&lt;<FONT color=#2b91af><FONT color=#2b91af>IOComponentOption</FONT></FONT>&gt;() <FONT color=#0000ff><FONT color=#0000ff>as</FONT></FONT> <FONT color=#2b91af><FONT color=#2b91af>IOComponentOption</FONT></FONT>;</FONT></FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#020002><FONT color=#020002>&nbsp;&nbsp; option</FONT></FONT>.<FONT color=#020002><FONT color=#020002>ComponentId</FONT></FONT> = <FONT color=#020002><FONT color=#020002>componentId</FONT></FONT>;</FONT></FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#020002><FONT color=#020002>&nbsp;&nbsp; option</FONT></FONT>.<FONT color=#020002><FONT color=#020002>Data</FONT></FONT> = <FONT color=#2b91af><FONT color=#2b91af>String</FONT></FONT>.<FONT color=#020002><FONT color=#020002>Empty</FONT></FONT>;</FONT></FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#020002><FONT color=#020002>&nbsp;&nbsp; option</FONT></FONT>.<FONT color=#020002><FONT color=#020002>AddToManager</FONT></FONT>();</FONT></FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#0000ff><FONT color=#0000ff>&nbsp;&nbsp; return</FONT></FONT>(<FONT color=#020002><FONT color=#020002>option</FONT></FONT>);</FONT></FONT></P><P><FONT size=2 face="Arial, Helvetica, sans-serif">}</FONT></P>]]>
   </description>
   <pubDate>Tue, 15 Dec 2009 11:26:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1588&amp;PID=5942#5942</guid>
  </item> 
 </channel>
</rss>