-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Hi Sean,
First, as a newbie to WPF, thank you so much for doing your series and tutorials. They have been quite invaluable over the past couple of months. Using your application as a template has been wonderful, but I had two questions surrounding the dependency injection process.
-
The services registered with dependency injection are only constructed when the application needs them (i.e. switching to a view or viewmodel for the first time). Is there a preferred method for loading specific services ahead of time so that any required (and time-consuming) startup processes for those services might be loaded ahead of time?
-
I have services that need to do cleanup, and so they inherit from IDisposable. I noticed those services that were loaded with dependency injection are not being disposed when the application closes. The ServiceProvider implementation itself also inherits from IDisposable, but is not being called (since the service provider only exists in the OnStartup method of the App (and not in some type of "using" statement). What is the preferred way to dispose of the service provider or any services registered within the service provider so that proper cleanup can occur?
Thanks for your help!
-Jason