I'm developing a WPF Client which interacts with a WCF Web Service which persists data on a database using NHibernate.
The client will use the MVVM design pattern for the UI and interacts with the WCF Service by sending and receiving DTOs.
From what I understand, only presentation data and logic should go in the View-Model, whereas the Model should contain the application's data and business logic.
Now let's use for example the case of a Login screen in the Client.
Here's my question: what exactly should go in the Model ?
Should it hold a reference to an interface of a WCF proxy using a dependency injection container such as MEF ?
Basically, the user would type in a username and password, which would update the properties in the view-model due to the databinding. Whenever the user presses the "Login" button on the view, a command is sent to the View-Model which in turn forwards it to the Model. The model then uses the Proxy interface to communicate with the WCF Web Service.
Is this approach correct ? If not, what exactly should go in the Model and View-Model?
The ViewModel in MVVM is a combination of the ApplicationModel and Controller in classic MVC. As such it is responsible for connecting to services to query for data to display and invoke operations against the service.
The workflow should be something like this:
The model shouldn't be aware of services and the like. Technically, you are using pure DTOs on the client side so it should have minimal logic, behind the service, there should be a richer model that does have business logic and validation.