I am using the Unity framework as IoC container.
My Config looks some like this:
<unity>
<container>
<register type="Namespace1.IFoo, FooAsm"
mapTo="Namespace2.Bar, BarAsm">
</register>
</conainer>
I would like to register a container to use a factory method. How do i achive it using the app.config?
I am looking for something like this:
<unity>
<container>
<register type="Namespace1.IFoo, FooAsm"
factory="Namespace2.Bar, BarAsm"
method="create">
</register>
</conainer>
</unity>
Any suggestsions?
This thread offers a nice response about how to add support of Factory methods for Unity. I fact you have to download this bitbucket source (and change the references to 4.0 framework).
If you now add Generic support for Unity you get a pretty awesome solution that might look like this:
Support of generic Factories for unity framework using xml configuration!
Thanks for all comments 🙂