Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One to One Entity
Message
 
À
12/06/2006 12:23:17
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01128468
Message ID:
01128567
Vues:
22
Darrell,

>I am using an existing DB. There are two tables that have a one to one relationship. The second table contains extended information from the first table. What is the best way to take advantage of the MM framework. Create two Business Objects and make the second a child (thus using the built-in functions such as savedataset) or create one Business Object and override the savedataset functionality?

You can do it either way, but you will probably end up writing less custom code if you create two business objects. You can morph them into one object by having one object "own" the other, and instantiate it as needed. For example, your "owning" business object could have a lazy-loaded property to reference the other business object like this:
public MyOtherBusinessObject OtherBusinessObject
{
   get 
   {
      if (this._otherBusinessObject == null)
      {
         this._otherBusinessObject = new MyOtherBusinessObject();
      }
      return this._otherBusinessObject;
   }
}
private MyOtherBusinessObject _otherBusinessObject;
Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform