Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dispose singletons on application exit with Ninject

Tags:

c#

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?

like image 590
devuxer Avatar asked Dec 13 '11 23:12

devuxer


1 Answers

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

like image 112
Remo Gloor Avatar answered Oct 24 '22 00:10

Remo Gloor