I'm exploring the partial class generation approach with the C# code smith templates, and it is not entirely clear to me how to hook up my "AddCustomRules" method in my handcrafted part of the partial class.
The generated code is below. How do I add my method to the addCustomRulesDelegate without changing the generated code?
protected override void AddBusinessRules(){
AddCommonRules();
onAddCustomRules();
}
private delegate void rulesAction(); // // Business Rules //[
NonSerialized()] private rulesAction addCustomRulesDelegate = null; private void onAddCustomRules(){
if (addCustomRulesDelegate != null)addCustomRulesDelegate();
}
Thanks for the quick answer, Xal - it worked, now I know!
Thanks xal, you beat me to it.
Since this is a delagate, you could also do as follow:
addCustomRulesDelegate = addCustomRules;
which is a shortcut version of:
addCustomRulesDelegate = new rulesAction(addCustomRules);
in Vb I believe it would be:
addCustomRulesDelegate = AddressOf addCustomRules
or
addCustomRulesDelegate = new rulesAction(AddressOf addCustomRules)
HTH,
Ricky
Copyright (c) Marimer LLC