I'm an IoC newbie, so I'm wondering if it's even the right tool for the job I want to do.
I'm writing a multi-tenant application, and there are several places that we might want to use different implementations of interfaces based on the organization to which the currently logged-on user belongs.
Say, for example, when a user from one organization creates a work order, that user's supervisor needs to be sent an email. But for all other organizations, that email doesn't need to be sent. Classic strategy pattern kind of thing.
My question is, can I somehow instruct the IoC container to look at a certain runtime value (the OrganizationId
of the logged on user in this case) to determine which implementation of the IWorkOrderProcessor
to inject into the constructor of the object that needs it?
I'm currently using Windsor, but examples using other containers would be fine.