Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating new update function
Message
 
À
08/05/2007 00:20:27
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01222682
Message ID:
01224161
Vues:
14
Larry,

>Right, which is what I've done in the meantime, however that means I now have two different objects instead of one with multiple save/update methods. The stored procedures aren't the concern, it's how do I create multiple save methods (different number of parameters) in one generated object.

The best way to handle this is to have a single business object use multiple data access objects. mmBusinessObject has some built-in functionality to handle this, but it assumes one data access class per database key.

You can override your business object's GetDataAccessObject() method something like this:
public override mmDataAccessBase GetDataAccessObject(string databaseKey)
{
	if (SomeCondition)
	{
		return this.DataAccessObject;
	}
	else
	{
		return this.DataAccessObject1;
	}
}
The DataAccessObject property already exists on your business object and returns a data access class of a specfic type. You can create another property (e.g. DataAccessObject1) that also has lazy instantiation (see the code in DataAccessObject for details). In your override of GetDataAccessObject() you can check some condition to see which data access object to return.

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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform