Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parent/Child Editing Ok, Not Adding
Message
De
11/09/2009 18:43:06
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:
01423691
Message ID:
01423789
Vues:
63
>Hi All,
>
>I'm missing something. I have a parent/child relationship set up w/ two business objects, and as long as the data exists for the objects I can edit everything on the form just fine and updates go to the respective tables properly.
>
>However, if I'm adding a new entity, the parent entity adds fine but the child's primary key doesn't get saved (it does go into the table with a 'zero' value).
>
>In the child business object's constructor, I've set the following proerties:
>
>this.PrimaryKey = "numMemIndID";
>this.HookConstructor();
>this.EntityCentric = true;
>this.AutoSaveOnParentSaved = true;
>this.AutoNewOnParentAdded = true;
>this.AutoDeleteOnParentDeleted = true;
>this.AutoEmptyOnParentAdded = true;
>this.ForeignParentKeyField = "numIndId";
>
>and to set the relationship on the form I've got
>
>        // Instantiate and register the business objects
>        this.oContact = (Contact)this.RegisterBizObj(new Contact());
>        this.oMemberLink = (MemInd)this.RegisterBizObj(new MemInd());
>        this.oContact.RegisterChildBizObj(this.oMemberLink);
>        lNewContact = (Int32.Equals(this.contactId, 0));
>        if (lNewContact)
>        {
>            this.oContact.NewEntity();
>           // Shouldn't have to do anything here, right?
>        }
>        else {
>            // Get the Customer Entity object loaded
>            this.oContact.getContactByID(this.contactId);
>            this.oMemberLink.getLinkForContact(this.contactId);
>         }
>
>
>Thanks for looking,
>
>Eric

I don't see where you are doing your save, but try registering your parent biz obj with this:
this.oContact = (Contact)this.RegisterPrimaryBizObj(new Contact());
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform