devuxer
devuxer

Reputation: 42394

Dispose singletons on application exit with Ninject

I'm using Ninject for a desktop application. I'm noticing that if I exit the app, singletons that implement IDisposable are not being disposed.

What is the best practice for ensuring all IDisposable singleton objects get disposed of properly with Ninject upon exiting a desktop application?

Upvotes: 6

Views: 1312

Answers (1)

Remo Gloor
Remo Gloor

Reputation: 32725

You have to dispose the kernel in order to dispose the remaining cached objects.

Upvotes: 8

Related Questions