在MVC模式的意义 [英] Model meaning in MVC

查看:188
本文介绍了在MVC模式的意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么模型ASP.NET MVC有时用作会谈到像的here 有时作为一个业务对象老残游记在应用程序之间传输数据一样的here

Why is MODEL in ASP.NET MVC sometimes used as part of an application that talks to a database like here and sometimes as a business object that "travels" across applications delivering data like here?

推荐答案

MVC已经演变为自Smalltalk的起点,在那里它经常被用来描述截然不同的架构,因为你已经发现了一点不同的方向。

MVC has evolved in different directions since its Smalltalk beginnings to the point where it is often used to describe very disparate architectures, as you've discovered.

有关MVC的演变这里Martin Fowler的博客。 http://martinfowler.com/eaaDev/uiArchs.html

Martin Fowler blogs about the evolution of MVC here. http://martinfowler.com/eaaDev/uiArchs.html

有是MVC,MVP和MVVM这里的区别的解释:
<一href=\"http://joel.inpointform.net/software-development/mvvm-vs-mvp-vs-mvc-the-differences-explained/\" rel=\"nofollow\">http://joel.inpointform.net/software-development/mvvm-vs-mvp-vs-mvc-the-differences-explained/

There is an explanation of the differences between MVC, MVP and MVVM here: http://joel.inpointform.net/software-development/mvvm-vs-mvp-vs-mvc-the-differences-explained/

我的10C:

ASP.NET MVC 3的许多例子更紧密配合比MVC MVVM模式。在MVVM,的ViewModels量身定制每个视图的数据细节(即的ViewModels不仅是域模型,但查看/ presentation层问题,如验证规则,字段提示/名,字段知名度等装饰) 。

Many examples of ASP.NET MVC 3 are more closely aligned to the MVVM pattern than MVC. In MVVM, ViewModels are tailored for the data specifics of each View (i.e. 'ViewModels' are not merely domain models, but are decorated with View / Presentation Tier concerns such as validation rules, field prompts / names, field visibility etc).

(返回MVC)在没有太大的必要后端分层较小的数据中心的项目中,M可以作为一个ORM模型(如用一些自动生成的波苏斯的.edmx)有一些规则一样简单。在这种情况下MVC勉强能算是一个应用程序的架构。

(Back to MVC) In smaller data centric projects without much need for back end tiering, M can be as simple as an ORM model (e.g. an .EDMX with some autogenerated POCOs) with a few rules. In this case MVC could just about be regarded as an application architecture.

但在使用MVC,原来的(Smalltalk的)'M'的模式,现在分成几个其它层,例如较大的项目域的实体,服务外墙,服务(如SOA),业务层和数据层等(所以在这里,男的 VC 的是presentation梯队模式,M是你的系统的其余部分) 。因此,例如,在这样的项目中,模型你的MVC项目的文件夹可以简单地代理服务引用,并使用与您的系统,甚至这种沟通的抽象的后端通信代理的域实体(如见在复合应用程序块中使用的服务代理/服务外墙)。

But in larger projects using MVC, the original (Smalltalk) 'M' of model is now split up into several other layers, e.g. domain entities, service facades, Service (e.g. SOA), Business, and Data Tiers, etc (so here, M VC is a presentation tier pattern, and M is the rest of your system). So for example in such a project, the 'Models' folder of your MVC project could simply be proxied service references and proxied domain entities used to communicate with the 'back end' of your system, or even an abstraction of this communication (e.g. see the service agent / service facades used in the Composite Application Block).

这篇关于在MVC模式的意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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