Add ability to override configuration in XML
The Binsor DSL has the extremely useful Extend macro, but it achieves this by replicating the ComponentModel data model, which isn't ideal.
So, the proposal is that we allow something along the lines of:
container.Register(
ExtendComponent.For<IService>.Parameters( <<so on and so on>>
)
Now, this is relatively simple to achieve if you can buffer the component registrations (in that ExtendComponent<For>.Component could return the original ComponentRegistration), but of course that would require a separate "process registrations step". A helper object might be needed.
The benefits should be relatively obvious. You could have your principal configuration done fluently within the code, with the environmental delta in a separate file, either XML, IronRuby or whatever.
This is gonna be pretty work consuming, postponed for vNext. We accept patches.
3 comments
-
Mark Seemann
commented
I may completely misunderstand this request, but Windsor has a convention where the first registration 'wins'. This means that if you read in XML config as the first thing, any registration there wins over subsequent registrations. However, if the XML config contains nothing, subsequent registrations kick in. You can use this feature to override default services with XML config.
-
Julian Birch
commented
Adding a reference to http://grahamnash.blogspot.com/2010/07/next-project.html. His remark about the deficiencies of DI containers are interesting, and the final one is directly addressed by this item.
-
Julian Birch
commented
An additional remark: a rather likeable way of delivering this might be to provide it on derived containers. Then you could have a container for everyone, and a derived container for each tenant.