<?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 : IIdGenerator using combined primary-keys</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : IIdGenerator using combined primary-keys</description>
  <pubDate>Wed, 29 Jul 2026 15:12:12 -700</pubDate>
  <lastBuildDate>Tue, 11 Jan 2011 01:08:35 -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=2416</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>IIdGenerator using combined primary-keys : Hi Sbelini, Yes that was actualy...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9618#9618</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 2416<br /><strong>Posted:</strong> 11-Jan-2011 at 1:08am<br /><br />Hi Sbelini,<DIV>Yes that was actualy the work around I was going to take. Actualy I will do it in a trigger as follows (for those that might run into the same problem) I will let the trigger maintain the idA and idB for the old software (update and insert triggers). However I will change the primary/foreighn keys to serial (autoincrement) and maintain those from the silverlight system. <BR></DIV><DIV>Such actually, I will&nbsp;have two key systems in the same table. Rather ugly but as the old application will disappear with the year(s) I can one day remove idA and idB. This also frees me from maintaing bad-keying system in the new Silverlight systems. It's quite a work re-keying all the foreighn tables (about 40 tables), but in the end I think it will pay off.</DIV><DIV>&nbsp;</DIV><DIV>Regards</DIV><DIV>&nbsp; TJ</DIV>]]>
   </description>
   <pubDate>Tue, 11 Jan 2011 01:08:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9618#9618</guid>
  </item> 
  <item>
   <title>IIdGenerator using combined primary-keys : Hi tj62,   Unfortunately, you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9614#9614</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> 2416<br /><strong>Posted:</strong> 10-Jan-2011 at 4:19pm<br /><br />Hi tj62, <DIV>&nbsp;</DIV><DIV>Unfortunately, you won't be able to reference an entity (or its ID for that matter) in the IIdGenerator. You could still use it to generate your ids, but not if the ids to be generated&nbsp;are dependent on another row value as criteria.</DIV><DIV>&nbsp;</DIV><DIV>What I can suggest&nbsp;is to implement this logic in an stored procedure. There you can access the FK (idA), check for the max value of the partial primary key (idB) for the rows matching idA, and then assign the value of idB properly.</DIV><DIV>&nbsp;</DIV><DIV>Best regards,</DIV><DIV>&nbsp;&nbsp; Silvio.</DIV>]]>
   </description>
   <pubDate>Mon, 10 Jan 2011 16:19:53 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9614#9614</guid>
  </item> 
  <item>
   <title>IIdGenerator using combined primary-keys : Any idea before I start working...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9558#9558</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 2416<br /><strong>Posted:</strong> 05-Jan-2011 at 1:23am<br /><br />Any idea before I start working on a horrible workaround?]]>
   </description>
   <pubDate>Wed, 05 Jan 2011 01:23:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9558#9558</guid>
  </item> 
  <item>
   <title>IIdGenerator using combined primary-keys : I recently started implementing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9548#9548</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 2416<br /><strong>Posted:</strong> 04-Jan-2011 at 4:31am<br /><br />I recently started implementing the IIdGenerator interface as I need pritty advanced id-generation. There are some rules I'm forced to follow when creating this, as the database is shared with some old software systems written in C++ and more. Unfortunately I'm not allowed to change the database using GUID or autoincrements.&nbsp;Let me simplify things by explaining a general example. Let us say we have two tabels defined such: <DIV><BR>tableA</DIV><DIV>&nbsp; int idA&nbsp; // primary key</DIV><DIV>&nbsp; varchar(50) aName</DIV><DIV>&nbsp;</DIV><DIV>tableB</DIV><DIV>&nbsp; int idA // partial primary key and foreighn key to tableA</DIV><DIV>&nbsp; int idB // partial primary key</DIV><DIV>&nbsp; varchar(50) bName</DIV><DIV>&nbsp;</DIV><DIV>As you se,&nbsp;the primary key of tableB is made up by two integers where the first one is a foreighn key to tableA.</DIV><DIV>The rules are such whenever I create an entry in tableB, idB has to increment from one (1). Example</DIV><DIV>&nbsp;</DIV><DIV>TableA</DIV><DIV>&nbsp;&nbsp; idA = 1</DIV><DIV>&nbsp;&nbsp; TableB<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idA = 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idB = 1 (for the first record under TableA.idA=1)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idB = 2 (for the&nbsp;second record under TableA.idA=1)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idB = 3 (for the&nbsp;third record under TableA.idA=1)</DIV><DIV>&nbsp;</DIV><DIV>TableA</DIV><DIV>&nbsp; idA = 2 <DIV>&nbsp;&nbsp; TableB<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idA =&nbsp;2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idB = 1 (for the first record under TableA.idA=2) <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; idB = 2 (for the&nbsp;second record under TableA.idA=2)</DIV>&nbsp;</DIV><DIV>So I allways have to stard idB from 1 in TableB,&nbsp;for each new record in TableA<BR><BR>The problem is how can I in the server side call to</DIV><DIV><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><P>public</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>UniqueIdMap</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> GetRealIdMap(</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>UniqueIdCollection</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> tempIds, </FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>IDataSourceKey</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> dataSourceKey)</P></FONT></FONT></DIV><DIV>find out for what idA it is called when requesting real Id for for TableB.idB? If I had that information it would be easy for my to request a valid idB from the database in GetRealIdMap. But without it I can't.<BR><BR>Second question is If I add entities to TableA as well as TableB and then perform save (both eintities with temporary Ids) is it guranteed that the TableA entity is saved first before calling GetRealIdMap for the TableB entity so that I know the real idA at that time...or is it all done in one call to GetRealIdMap?</DIV></DIV>]]>
   </description>
   <pubDate>Tue, 04 Jan 2011 04:31:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2416&amp;PID=9548#9548</guid>
  </item> 
 </channel>
</rss>