MVC .NET For the Desktop?
I've developed some ASP.NET MVC apps, and loving the framework. However, one thing I don't quite understand is why it's limited to web UIs. It seems like one of the reasons for a separation of the view and controller is to allow for multiple views to reuse the same controller logic. For example, I should be able to hang a WPF UI on the same controllers as the Web UI. I suspect, though, that I'm misunderstanding something fundamental about separation of concerns. Is there a reason ASP.NET MVC controllers are limited to use in web applications?
Update: I'm less interested in "is it possible to do MVC on the Desktop" - I know Prism, etc. allow this. However from a design standpoint, one of the "reasons" we want separation of concerns is for reusability. If we can't reuse the controllers, it feels like we're repeating ourselves when rewriting identical logic in a WPF app. The answers below do clarify this some for me though.
The primary difference between ASP.NET MVC and ASP.NET Core is their cross-platform approach. ASP.NET Core can be used on Windows, Mac, or Linux, whereas ASP.NET MVC can only be used for applications on Windows.
ASP.NET MVC is no longer in active development.
I have to say the the MVC model is specially practical in web apps, and that's because the view (the html page) is really disconnected and far away from the controler and the model.
In desktop apps, that is not the case, and you will be soon missing some opportunities the break the pattern to make the app more useful.
For example, you can't do the powerful and time-saver databinding in WPF, because it breaks the MVC pattern.
A good pattern used in WPF is M-V-VM
Model View Controller is a pattern, ASP.NET MVC is that pattern applied to ASP.NET's web framework. As its been mentioned, this ties url routing into things to make navigation simpler and more integral to how actions are called.
That said, nothing is technically preventing you from using components in ASP.NET MVC libraries. The data access layers via LINQ or Entities are available outside ASP.NET MVC. Likewise, the pattern itself has countless examples of its implementation for Winforms applications. The same techniques could be applied to WPF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With