ProjectExtensions/ProjectExtensions.Azure.ServiceBus — Issue #15: Deal with IDisposable message handlers that are per-instance
Author: tcabanski
Created: 2011-12-26 13:01:55+00:00
State: open

Per-instance message handlers could also implement IDisposable. If they do, they have to be "released" when we are done with them. This is not the same as calling dispose directly (at least for most containers). Most IoC containers have some concept of Release. For example, Castle Windsor has an explicit release method. Some IoC container have the concept of a sub-container that calls IDispose for its components when it goes out of scope. This does have to be handled because, for at least Castle Windsor, this can cause memory leaks because in some cases the IoC container will hold onto the reference until the component is released or until the container itself is disposed.