Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constructor Hook for BO's
Message
From
07/05/2007 21:57:46
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Constructor Hook for BO's
Miscellaneous
Thread ID:
01223257
Message ID:
01223257
Views:
64
Hi!

I am posting this again as I am not sure if it was missed or not.

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

Problem:
All the code that I add to the BO's constructor is overwritten everytime I run/re-run the BLG.

e.g.
public OrderDetail()
{
   // Code generated by the BLG (in the OrderDetail.cs file)
   this.TableName = "OrderDetails";
   this.PhysicalDbcObjectName = "Order Details";
   this.PrimaryKeys = new string[] {"OrderID", "ProductID"};
   
   // Code that I add later (also in the OrderDetail.cs file)
   // This can be different based on the BO
   // The code below is overwritten everytime I run/rerun the BLG.
   this.AutoSaveOnParentSaved = true;
   this.AutoCancelOnParentCancel = true;
   this.AutoDeleteOnParentDeleted = true;
   this.AutoEmptyOnParentAdded = true;
   this.ForeignParentKeyField = "OrderID";
}
If there is an overriden/overloaded PreConstructor() or PostConstructor() Hook available then I could write my code in it and not loose my changes.
Similar to the
protected override void HookParentNavigated(mmBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
or
protected override void HookParentRetrieved(mmBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
e.g.
protected override void HookPostConstructor()
{
   // Code that I add later (in the OrderDetail.Partial.cs file)
   // This can be different based on the BO
   // This is now safe as the BLG will not overwrite this
   // as it is in a different physical file (OrderDetail.Partial.cs )
   this.AutoSaveOnParentSaved = true;
   this.AutoCancelOnParentCancel = true;
   this.AutoDeleteOnParentDeleted = true;
   this.AutoEmptyOnParentAdded = true;
   this.ForeignParentKeyField = "OrderID";
}
Sarosh
Next
Reply
Map
View

Click here to load this message in the networking platform