Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constructor Hooks
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01222803
Message ID:
01223283
Vues:
17
Sarosh,

>Just wondering what the correct approach would be in creating a Pre/Post Constructor Hook for BO's?

You can add a hook method in ABusinessObject. For example:
public ABusinessObject()
{
	this.DatabaseKey = "PostgresTest";
	this.HookInit();
}

public virtual void HookInit()
{
}
I'm not sure that a "dual" hook is necessary here (pre/post) due to the specialness of constructor methods...they are automatically called from the top down (from System.Object down to your application-level class) and they are not inherited. At any rate, this provides a hook into which you can place constructor code that can be added to a partial class that is not overwritten.

FYI, although we already generate all our business object classes as partial classes, we are adding the option to the BLG so it will generate these for you.

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