In a previous posting, I talked about how Windsor can select a particular implementation depending on some criteria we are interested in such as who the current customer is. This is done through the IHandlerSelector interface which is used in the call to the Resolve method on the container. All well and good.
One of the techniques I like to use in my applications is the Domain Event pattern which I’d recommend you read if you’re not familliar with it. It’s essentially a nice way to keep our code loosely coupled. When the domain raises an event as the result of some state change it is ultimately resolved by an IoC container, in my case, Windsor. However, an event can have multiple handlers which means that in order to return all the handlers that we want to invoke for our event we must call the ResolveAll method on the container.
Continue reading “Handling Multitenancy with Castle Windsor – Part 2 (Domain Events)”