So, the answer should be pretty simple: as Mark Seemann wrote here:
A Composition Root is a (preferably) unique location in an application where modules are composed together. ( ... ) In WPF applications it's the Application.OnStartup method
I'm not sure about that OnStartup
method though. Let's say we have an application consisting of these projects with dependencies:
Domain <- App Services <- WPF Client (ViewModels PCL <- Executable WPF Client with Views)
MVVM pattern says that business logic should be proceeded in ViewModel. (EDIT: Ahh, I put it in wrong words:/ What I meant is: When you have business logic (in domain) in class Game, and it has method Move which returns true if the move finished the game - you don't need Game in your View. You need a Command - MoveCommand and Game in ViewModel. And View should know ONLY about that command ). View should only know what command, from which ViewModel has to be performed. So basically, View should ONLY know about ViewModel. Knowledge about Domain is useless in View.
So my question is: Which MVVM approach should I take?
- I want to keep best practices and create every object in composition root
- I want to have my business objects in view models, not in view
Is ViewModel-first (or MVVMC) the only approach that could work?