0

I will develop an application with Xamarin.Forms. I will use mvvm pattern, but I heart from someone that he used repository pattern and services layer with mvvm. What is the common way of working?

Ali Eren
  • 489
  • 10
  • 23

1 Answers1

0

So MvvM is the View ( UI) which is data bound to the ViewModel (DTO) and the Model ( which is a class/ blueprint of the object)

The Model is not the real object, the model is not the persisted data. So yes. You do need a Repository or Service or Factory something to Take the model objects and persistent them.

If you take a look at the Xamarin Forms courses in the university, they use the a hard coded list of Simpson characters which is provided to the View Model from the SimpsonFactory..

If you are building something that stores the data to a database or XML you need to add that Repository or Data Service.

Another Example of this is in the Xamarin CRM app. While it uses Azure data tables instead of direct SQLite connections, it still uses a DataService to make changes to the objects in their persisted state.

I hope this helps.

J3RM
  • 1,702
  • 12
  • 17