I am working on Simple injector DI framework. I need good ideas on how to register interface which is consumed in more than one provider (component).
Below is my requirement.
It is WebAPI project where I have a BaggageController class which will get a request for Add Baggage operation, Based on a provider from the request I have to route the request to concerned class. A Provider can be an Airline A or Airline B.
Request for AddBaggage(BaggageRequest, Provider) from client
--> BaggageController --> Business.Baggage.Implementation (Decision) --> Call Provider A
--> Call Provider B
Below is the code I am registering with Simple injector.
container.Register<iflightservice, providerb="">(Lifestyle.Scoped); --> This line throws an error as IFlightService is already registered.
Since my decision would be taken at runtime, I can not use the RegisterConditional method.
Is there any other way to register dependency at runtime using simple injector?