Why use MVVM in a WPF + EF + C#

Asked

Viewed 335 times

1

I searched several forums and articles and all say that the MVVM standard should be used when working with an EF + WPF project.

Can anyone tell me why that is? because I want to implement a system but I don’t know what would be the best architecture standard to use when it comes to Entity framework and WPF in C language#

  • Related: http://answall.com/q/21539/101

1 answer

1


You are not required to follow patterns, but it is good practice to follow them.

MVVM, nothing else is a standard with the same purpose of MVC, serves to separate responsibilities in layers. Model-View-Viewmodel.

Model: Data Model Responsible Layer ("table classes")

View: Presentation layer, layout, forms, screen

Viemodel: Layer that makes the communication between Model and View. Where is the logic of the application, as if it were the business layer.

Not everything should be done in the Viewmodel Layer, many things, mainly, actions that affect the View layer, such as animations, layout changes etc.. , can be done in the View layer.

The advantage is the ease of maintenance and application in other projects. For example, if developed for WPF (Desktop), you can easily transfer to Windows Phone or Windows Modern Apps by changing only the View layer for each of the platforms, changing the other layers slightly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.