ASP.NET MVC模型视图模型VS [英] ASP.NET MVC Model vs ViewModel

查看:106
本文介绍了ASP.NET MVC模型视图模型VS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,我一直听到关于关于MS的ASP.NET MVC的ViewModels的讨论。

OK, I have been hearing discussion about "ViewModels" in regards to MS's ASP.NET MVC.

现在,即拟以一种特定的模式,是否正确?没有一种特定的视图。

Now, that is intended to be a specific kind of Model, correct? Not a specific kind of View.

据我了解,它是一种模型具有与视图交互的具体目的是什么?或者类似的东西?

To my understanding, it's a kind of Model that has a specific purpose of interacting with the View? Or something like that?

一些澄清将AP preciated。

Some clarification would be appreciated.

推荐答案

从本质上讲Model和View模式都是简单的类与属性。

Essentially Model and View Model are both simple classes with attributes.

这些类的主要目的是用来描述(为模型)的对象为各自是分别控制器和视图目标对象。

The main objective of these classes are to describe (to "Model") an object for their respective audiences that are respectively the controller and the view.

那么,你是完全正确时,你说

So you are completely right when you say

据我了解,这是一种
  具有的一个特定的目的模型
  与View交互

To my understanding, it's a kind of Model that has a specific purpose of interacting with the View

所以,虽然模型类有效的领域实体您的应用程序进行交互,视图模型是简单的类,你的看法与之交互。

So, while Model classes are effectively Domain Entities that your application interact with, View Models are simple classes that your views interact with.

希望它能帮助:)

更新

Microsoft开发了由马丁presentation模式的专用版本福勒主要是基于模型 - 视图 - 控制器,并把它称为模型 - 视图 - 视图模型(MVVM)为PF应用。这种模式是针对那里UI开发人员有更多的基础上比传统的开发业务逻辑不同的要求现代的UI开发平台。这里看看了一点理论

Microsoft has developed a specialized version of the Presentation Pattern by Martin fowler largely based on the Model-View-Controller and called it Model-View-ViewModel (MVVM) for PF application. This pattern is targeted at modern UI development platforms where UI developers have different requirements based more on business logic than traditional developers. Have a look here for a bit of theory

这篇关于ASP.NET MVC模型视图模型VS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆