Guidance: Overriding default creation policies

Mar 26, 2008 at 5:50 PM
I'm currently creating an extension that creates objects through XmlSerialization. However, it appears that the default creation strategy is executing before my strategy is called. The only way I can get it working at the moment is to add my strategy to PreCreation, which just seems bad. I've tried implementing ICreationPolicy and setting that to my target type, but that doesn't seem to be working too well. Is there a way I can get my strategy to execute before the default strategy that doesn't involve PreCreation?

Thanks!
Mar 26, 2008 at 5:57 PM
With Unity, creation is performed through IBuildPlanPolicy + BuildPlanStrategy. It doesn't use ICreationPolicy.

If you want to override the creation for a given type, you should either use the StaticFactoryExtension or roll out your own; but in any scenario, it's by setting a new IBuildPlanPolicy or IBuildPlanCreator.
Mar 26, 2008 at 7:00 PM
Exactly what I was looking for. Thanks!