Here’s my problem: I have a computer program (for simulating a vehicle) with a lot of configurable parameters (on the order of 100). The company has traditionally had their own hand-rolled IoC contraption that loads several XML files defining services and parameters. However, lately they want to start the program from a different program (entitled MC) that generates a subset of the parameters specific to each instance.
I’ve used autofac and ninject2 for other projects, but I’m not seeing quite what I need in them at the moment. I like autofac’s XML support. However, I don’t really want the MC program to know about all the services of my child program. And I’m not sure the XML merging there is sufficient for my needs.
As one solution, I’ve considered an IoC container that would easily allow me to fill parameters and properties on services from command line parameters. I assume that would be set up in code as part of registering the services with the container. The container should have an easy way to print and validate said command line parameters. (My parameters are typically real numbers and IP addresses.) Has anyone seen anything like this out in the wild?
I’ve also been pondering something similar for passing in parameters in XML. Essentially, as part of setting up the IoC you would specify an XML path where that parameter could be obtained. You would then pass XML/filenames to the IoC to fill these. Maybe there is some other parameter format better than XML? It would be helpful if the IoC could spit out a settings schema that would allow me to validate settings files and use that as a standard for other programs that want to configure mine. Thoughts?
Castle windsor had the notion of a IWindsorInstaller – http://stw.castleproject.org/Windsor.Installers.ashx, which is a class for installing the container.
You can implement it however makes sense for your project – xml, command line, whatever, so long as it fills the container as a result.
I think you could use it effectively in the scenario you describe