Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constructor Hooks
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01222803
Message ID:
01223283
Views:
23
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform