Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple Instances of the Same BO
Message
De
17/06/2010 15:10:07
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
17/06/2010 14:03:04
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01469400
Message ID:
01469477
Vues:
40
>>>Hi,
>>>
>>>I'm using MM.NET 3.6
>>>
>>>I have a Policy which can have three people associated with it, the Insured, the Owner and the Payor. These three will be based on my "Person" BO. I have a feeling I had earlier encountered problems with having two separate instances based on the same BO in that they stepped on each other's toes. What is the suggested way to allow this? Do I need to make three separate BOs (all exactly the same except named differently)?
>>>
>>>Update:
>>>
>>>I want to be able to actually add/edit the Insured, Owner & Payor objects while adding/editing the Policy.
>>
>>It is not desireable to have more than one Business object class representing the same business object. There are several techniques for updating data in the same business object from more than one selection. If you can give me an example of one of those situations I will see if I can give you an idea of how to best do that.
>>Tim
>
>Hi Tim,
>
>I have a form that is displaying the Insured person's details, the Owner's details and the Payors details as well as the Insurance Policy.
>
>What I would have done in VFP using Visual MaxFrame is create three different BO instances based on my Person Business Object as well as a BO for the Policy. Then I can add a Policy and add the Insured, Owner and Payor and relate them properly and they wouldn't step on each other (for example if I changed the oInsured.name, this would not overwrite the oOwner.name (which is what I
>think I experienced earlier when dealing with Clients and their Spouses).
>
>So how should I approach this?

I don't think there would be anything preventing you from creating more than one instance of the same BO. My previous posts have always said, it wasn't really best practice to create multiple business object classes that essentially duplicate functionality.
Contact oOwner = new Contact();
Contact oPayor = new Contact();
You may very well run into some issues with binding since the BindingSource takes the business object name but you may be able to get around that with an alias; I have not tried. When the data gets stepped on is when you call the same business object instance and call for data a second time without specifiying a different table name. If you use the same business object and get two sets of data you need to specify a table name other than the default for at least one of those calls. You can bind the data with the bo.tablename to specify which table it is bound to. If you don't specify a table name the default table name is used.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform