this is probably just a beginners question, but I have the following:
public class FooSettings {} public class BarSettings {} public class DohSettings {}
A FooSettings or BarSettings instance is provided from an external source ie:
object settings = GetSettings();
And now, I would like to enable ProcessorConsumer based on entering an existing settings instance, for example:
container.RegisterAssemblyTypes(...);
That is, if an instance of FooSettings is provided, then the FooProcessor is created and entered into the ProcessorConsumer, which is then resolved by the instance.
I was not able to figure out how to do this in StructureMap, Ninject, or Autofac ... perhaps because I am new when it comes to IoC containers. Thus, the answers to all these or those containers, so that they can be compared, were highly appreciated.
UPDATE: I am looking for a solution that easily allows you to add new settings and processors. A unidirectional mapping from the settings type to the processor type will also be displayed. But it also allows you to enter other instances / services in a particular type of processor based on its constructor settings. That is, for some processors, the IResourceProvider service or similar may be required. Here is an example.
Ideally, I would like something like
container.For<IProcessor>.InjectConstructorParameter(settings)
or similar. Thus, directing the IoC container to use the processor type corresponding to the inclinated instance of the constructor parameter.