Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constructor Hook for BO's
Message
De
07/05/2007 21:57:46
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Constructor Hook for BO's
Divers
Thread ID:
01223257
Message ID:
01223257
Vues:
58
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform