UnityBuilderStage.PostCreation ?

Mar 31, 2008 at 1:31 PM
Edited Mar 31, 2008 at 1:32 PM
Would it be possible to create a new stage for PostCreation?

For example, I'm wanting to run strategies after an object is created, but before properties are set (initialization). Actually, for the sake of consistency, I'd like to suggest adding PreInitialization as well, so that we have Pre and Post for both creation and initialization, just to cover any further possible wacky scenarios like mine. :)
Apr 1, 2008 at 6:15 AM
It's a little harder than than, unfortunately. The constructor is called and the properties are set via the dynamically generated IL. As such, if you want to get something in between those operations, you'll need to add to the BuildPlanStrategies and generate IL.

In that case, you can just add your new strategy to the Creation stage. Adding strategies always goes to the end of the stage to add them to, so it'll run after the constructor but before properties are set.