Jon Archway
Jon Archway

Reputation: 4892

WCF Unity and Object Disposal

If using Unity with WCF using an implementation such as that shown in this article: WCF and Unity 2.0 are there any explicit disposal activities you need to be concerned about?

For example, let's assume an operation on the service is using an unmanaged resource as a construction injection parameter, how would this get disposed of properly? Also, I assume there is no concerns with managed resources that are being instantiated via Unity and they will be released when the service is finished with? i.e. after each call in per call.

Thanks

Upvotes: 1

Views: 641

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364319

It depends on selected lifetime management of your injections. I wrote the article about different lifetime managers in Unity. In short - only ContainerControlledLifetimeManager (singleton) and HiearchicalLifetimeManager will handle dispose for you. In all other cases you are responsible for handling disposal of injections.

Upvotes: 1

Related Questions