如何MVC(ASP.NET MVC)带3层​​架构可以一起工作? [英] How MVC (ASP.NET MVC) band 3-tier architecture can work together?

查看:105
本文介绍了如何MVC(ASP.NET MVC)带3层​​架构可以一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个设计文档和人民对我的团队都愿意做,从ASP.NET Web窗体移动到ASP.NET MVC。这是伟大的,但我有一个很难理解的3层如何MVC workswith(数据层,业务层和presentation层)架构。我们可以说,模型,视图和控制器是presentation层的一部分?是业务层的Model部分?

I am writing a design document and people on my team are willing to do the move from ASP.NET WebForm to ASP.NET MVC. This is great, but I have a hard time to understand how MVC workswith in a 3-tier (Data Layer, Business Layer and Presentation Layer) architecture. Can we say that the Model, View and Controller are part of the Presentation Layer? Is the Model part of the Business Layer?

在短暂的,如何MVC和三层架构可以一起工作?感谢您的帮助!

In brief, how MVC and 3-tier architecture can work together? Thanks for the help!

推荐答案

我认为ASP.Net MVC是在presentation层。它使用的模型类确实视图模型,它描述了你的看法所需的数据结构。您所有的业务逻辑和数据的访问应该从你的MVC模型和控制器保持独立。

I consider ASP.Net MVC to be in the presentation layer. The "Model" classes it uses are really View Models, which describe the data structures needed by your views. All of your business logic and data access should remain separate from your MVC models and controllers.

此外,一般的最佳实践为MVC是保持控制器code尽可能的简单,这通常意味着引入一些应用服务为处理繁重的业务层。

Also, the general "Best Practice" for MVC is to keep the controller code as simple as possible, which usually means introducing some for of application service into your business layer that handles the heavy lifting.

这篇关于如何MVC(ASP.NET MVC)带3层​​架构可以一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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