MVC之间的分离与Ntier中的分离 [英] separation among MVC vs separation in ntier

查看:109
本文介绍了MVC之间的分离与Ntier中的分离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了一些文章,如果我更改了一个不会影响另一层的内容,那么我在ntier UI层中将其与业务和数据库层分开了,

如果我更改不会影响模态和控制器的视图,则与mvc相同,

I read some articles from which i fetched that in ntier UI layer is separated from business & db layer, if i change in one that will not affect the other layer,

the same is with mvc if i change the view that will not affect the modal & controllers ,
so that is the same as i suppose?

推荐答案

您在某种程度上是正确的.每一层都依赖于系统中的其他层来执行完整的任务.您的层级的基本思考过程应如下.
1)UI层仅用于与用户交互.那就是显示数据并从用户那里获得输入.该层与Controller/Services层交互.
2)您的控制器/服务应管理将要显示给用户的数据,并决定如何使用从用户那里接收的输入来进行操作.该层将与系统中的数据层进行交互.该层将强制执行所需的任何应用程序级业务规则.
3)您的数据层仅与管理数据有关.其中包括读写数据库等.

请注意,这绝不是MVC的全面概述.这只是一个非常基本的概括.
You are correct to some extent. Each layer depends on the other layers in the system to perform a complete task. The basic thought process for your tiers should be as follows.
1) UI layer is used only to interact with the user. That is to display data and to get input from the user. This layer interacts with the Controller/Services layer.
2) Your Controller/Services should manage what the data is that is to be displayed to the user and decided what is to be done with input received from the user. This layer will interact with the data tier in your system. This layer will enforce any application level business rules that are required.
3) Your Data layer is concerned only with managing your data. That includes reading and writing to a database, etc.

Please note that this is by no means a comprehensive overview of MVC. It is just a very basic generalization.


这篇关于MVC之间的分离与Ntier中的分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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