Reputation: 34800
In my application each tenant has it's own StructureMap container.
At runtime, tenant instances may be shutdown or restarted. Is there any tidying up I should do (such as calling IContainer.Dispose) or should I just let Garbage Collection do it's job?
We do have a number of singleton instances that implement IDisposable. Ideally we should call Dispose on these prior to disposing the container. I know this is done automatically on a Nested Container but wasn't sure about a standard container?
Thanks,
Ben
Upvotes: 2
Views: 1975
Reputation: 8019
Call dispose on the containers.
You should never "just let the Garbage Collector do its job". See my response to this post to understand why:
Is it bad practice to depend on the garbage collector
Upvotes: 0
Reputation: 2160
You should call Dispose on your container, which will dispose cached instances for you.
Upvotes: 5