且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC开发一个分层架构

更新时间:2023-01-07 08:41:27

从您发布它看起来像解决方案(One解决方案)有三个不同的项目结构:

From the structure you posted it looks like the solution (One solution) has three different projects:


  • 1 Project.web :该网站项目本身在那里你会
    把所有的意见,CSS,脚本......在一个理想的实现
    MVC的(这取决于你是谁交谈)的网站项目
    应该完全没有逻辑,而且只有responsabilty应该是
    呈现信息给用户的。所以基本上在 V 的一部分
    MVC的。

  • 2 - Project.DataAccess :这是在 M ;该项目应
    管理该项目的所有数据部分,这包括:DAL,
    ORM,资料库,UOW ...

  • 3 Project.Business C 的一部分,所有的业务逻辑
    正在地方,基本上所有的类的做硬
    工作中,我认为它是CPU中。

  • 1- Project.web: That the website project itself where you will have all of your views, css, scripts ... in an "ideal implementation of MVC" (depending who are you talking to) the website project should have no logic at all and it's only responsabilty should be the render of the info to the user. so it's basically the V part of the MVC.
  • 2- Project.DataAccess: that's the M ; the project should manage all the data portion of the project and that includes: DAL, ORM, Repositories, UoW...
  • 3- Project.Business The C part, where all the business logic is taking place , where basically all of your classes doing the hard work , i think of it as the CPU.

您提到的2个项目是类库项目和Web是一个网站项目,这是一个架构我跟着来组织我的项目/解决方案。

You mentioned that the 2 projects are class library projects and the Web is a WebSite project and this is an architecture i follow to organize my projects/solution.

请注意,这是一个架构设计,组织项目,绝不是唯一或***的之一。但与任何设计,你可以遵循尽量尊重的SOC(关注点分离)MVC模式的目的。

Please note that this is an architecture design to organize your projects and in no way is the only or best one. but with any design you might follow try to respect the SoC (Separation of Concerns) goal of the MVC pattern.