Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Child BO not saving
Message
 
À
28/07/2010 16:52:51
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01474335
Message ID:
01474393
Vues:
33
Definitely the problem is in mmBusinessObjectGeneric.PopulateForeignKeyField(). In the call to
this.PopulateKeyField(this.ForeignParentKeyField, this.ParentKeyValue)
this.ParentKeyValue is 0! Should be the, well the parent object's primary key value I would think.

Now, where is that supposed to get set...? Looks like mmBusinessObject.StateChangeHandler.

Ok, this is odd. That fires for the Parent object, but never for the child object. Where does that get assigned? Here it is in mmBusinessObject.RegisterChildBizObj()
// Register the child business object with the StateChange and
// Transaction StateChange handlers
this.StateChange += new mmBusinessStateChangeDelegate(childObject.StateChangeHandler);
Might this be the problem? In mmBusinessObjectGeneric.SaveEntity(), the PopulateForeignParentKeyField() is called before the PreSaveEntityProcessing() (which calls the OnStateChange that actually sets the ParentKeyValue.
// If a parent foreign key is specified, save the last
// foreign key value into the specified field
this.PopulateForeignParentKeyField();
if (this.PreSaveEntityProcessing(entity))
...
What happens if I force a PopulateForeignParentKeyField() after the PreSaveEntityProcessing()?

Ugh, I'd have to recompile MM.Net. Trying a few things but I think I'm onto something here....

Eric


>>Coincidentally, I'm having the exact same problem but only when trying to save new children. Existing ones save fine. The problem seems to be that the foreign key is not populating (a record does get saved, just with no foreign key). Is the syntax right, in that we just have to name the field or is there more needed?
>>
>>I've run through the debugger and get down the SaveChildObjects() and PopulateForeignKeyField() and the value that it's trying to save is zero, rather than the parent object's primary key value.
>>
>>Eric
>
>Hmm, I seem to remember a similar post awhile back. I wonder if there is some combination that causes that problem and Kevin had chimed in. Might should do a search here in this forum to see if that message is the same issue.
>Tim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform