﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum / StrataFrame Application Framework / Business Objects and Data Access (How do I?)  / Parent -&amp;gt; Child &amp;lt;- Parent Relationship / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Thu, 21 Aug 2008 16:53:55 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Parent -&amp;gt; Child &amp;lt;- Parent Relationship</title><link>http://forum.strataframe.net/Topic14000-6-1.aspx</link><description>The only reason that this would not work like any other BO is if the ParentBusinessObject property is not set and a parent relationship not defined.  As you know, the BO will propagate the parent's newly created PK to the children....BUT, if you are pre-populating the child records with a NULL value, then the parent doesn't know what the child record would be.  For example, if you setup the ParentBusinessObject property and create a new child record, the child will immediately (upon creation of the new record) update that relationship field with the value of the parent foreign key.  In this instance, when the save occurs the parent knows how to update the child record with the new "official" primary key since it knew what the temp PK was within the BO.  But if you override this with NULLs then the parent will not be able to sync back with the child records.</description><pubDate>Tue, 05 Feb 2008 09:20:21 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>Parent -&amp;gt; Child &amp;lt;- Parent Relationship</title><link>http://forum.strataframe.net/Topic14000-6-1.aspx</link><description>Howdy everyone:&lt;P&gt;I have an address design that factors out the actual address information into a separate table (CCAddress) and links this address to the appropriate entity (either a Company or a Salesman) via a foreign key relationship.  In essence the following&lt;/P&gt;&lt;P&gt;CCCompany.comp_pk&lt;/P&gt;&lt;P&gt;                                  CCAddrLink.adlk_comp_pk&lt;/P&gt;&lt;P&gt;                                  CCAddrLink.adlk_addr_pk                   CCAddress.addr_pk&lt;/P&gt;&lt;P&gt;                                  CCAddrLink.adlk_agnt_pk&lt;/P&gt;&lt;P&gt;CCSalesAgent.agnt_pk&lt;/P&gt;&lt;P&gt;The parent child relationship setup at design time is as follows:&lt;/P&gt;&lt;P&gt;CCSalesAgent.agnt_pk -&amp;gt; CCAddrLink.adlk_agnt_pk and when it runs CCSalesAgent is the parent business object of CCAddrLink&lt;/P&gt;&lt;P&gt;The default values for CCAddrLink.adlk_agnt_pk and CCAddrLink.adlk_comp_pk is set to null through the use of a nullable type (set in the BOMapper).  When a new record is added I simply set these to properties to NULL.  This is necessary since either one or the other FK must be null (only one address can apply to another entity, not two ... the null value in the unused FK field prevents the DRI from triggering).&lt;/P&gt;&lt;P&gt;The question is this, when I call the oAddressLink.Save() method the framework should automatically link the parent and the &lt;FONT size=2&gt;PushDataToChildren() method in the business layer, unfortunately, this is not happening and I was forced to manually update the links and wrap it all in a transaction ... not a big deal but I'd prefer not to do that.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;[b]My question is this, does prepopulating the foreign keys with null values prior to calling the save stop the framework from pushing primary keys to children ... I don't think it should but does it?[/b]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;CT&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 05 Feb 2008 08:34:28 GMT</pubDate><dc:creator>Charles Thomas Blankenship</dc:creator></item></channel></rss>