And just to prove the point, I just threw together a sample implementation of such an extension.
The source is available from my BitBucket account.
This is just from me, not an official p&p deliverable, not part of the package, no guarantee, it may delete your hard drive and tie dye your cat.
But what it does do is let you do this:
<sectionExtension type="Unity.FactoryConfig.FactoryConfigExtension, Unity.FactoryConfig"/>
<factory type="MyClassFactory" method="CreateInstance" />
As long as MyClassFactory.CreateInstance is a public, static method wiith one of these signatures:
- no parameters
- IUnityContainer, Type, string
it should work just fine.
I'll write up a blog post later on how this works, but just wanted to share the code out ahead of time.