I'm trying to apply DI to my WPF application (with MVVM). I would like to adhere to an onion architecture, and as such, my model has an IRepository
interface which is injected via an IoC container into the application from its composition root.
There are countless sources like this SO answer and this post on wpftutorial.net that talk about DI with WPF but which show the repository being injected into the view model. Doing that doesn't seem right to me. The view model, in my mind, should not be concerned (i.e. should not know about) the repository.
Is there a way to design my application so it properly adheres to the onion architecture and does not involve the presentation layer in the repository dependency injection (inasmuch as that's possible, given that the composition root must be in the top-level/executable where the views reside)?