MVC.NET for the desktop

后端 未结 4 1631
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-09 06:25

Is there any reason that MVC isn\'t equally useful for desktop apps as for web apps?

What would be required to make an ASP.NET MVC directory tree implementable as a de

相关标签:
4条回答
  • 2021-02-09 06:50

    Hmmm... well, your view can be rendered as anything... HTML, XML, etc. So, why not XAML? I wonder if you can get your WPF or Silverlight app to work in the MVC framework this way... that is, not requiring a web server to run.

    0 讨论(0)
  • 2021-02-09 06:56

    There is nothing stopping you from using the MVC pattern in a desktop app. In fact, it has been used on the desktop since before there was a web.

    See Wikipedia for some examples

    MVC just stands for "Model View Controller" which describes the way that concerns are separated from each other using the MVC pattern.

    As far as using ASP.NET MVC on the desktop, there are a few problems. For one thing, it relies on HTTP requests and responses. You would need a server layer as part of your application architecture to listen for requests and send responses. Second, ASP.NET MVC views are really just simple HTML text files meant to be interpreted by a web browswer. So, you would need an HTML rendering component as a GUI front-end. You would likely want a CSS rendering engine and a JavaScript interpreter as well.

    Basically, all you would be doing is running a dedicated browser as the front-end and a local web server as the back end.

    There is really not much need since there are many great MVC frameworks already. There are also closely related patterns like MVP (Model View Presenter) and MVVM (Model-View-View Model). For example, many WPF (Windows Presentation Framework) apps are MVVM.

    0 讨论(0)
  • 2021-02-09 06:58

    I've always thought of the term MVC as the same as a n-layer application - so correct me if I'm wrong here folks.

    When i develope, I always(unless other instructed) use the following model/structure, also in applications:

    GUI(Web, Winform, whatever) -> Business logic -> Data layer -> And also with an underlying "Model"

    ... Which is a sort of MVC - So yes, it is usefull for desktop apps also. The main advantage with this, is that you can develope web, win and mobile(++) applications based on the same code.

    Another thing that could be done, is to create the data/businesslayers as web-services...

    I think this aproach would qualify as SOA.

    EDIT: As a note, the four levels of applications are created as seperate projects - and then used as adding reference to either the project, or the DLL, or from the GAC(or wherever you like.....) :) Thus, the need for a directory structure is not needed.

    0 讨论(0)
  • 2021-02-09 06:59

    Prism

    0 讨论(0)
提交回复
热议问题