是否有在ASP.NET MVC解决方案定义项目的标准做法? [英] Is there any standard approach for defining projects in an ASP.NET MVC solution?

查看:113
本文介绍了是否有在ASP.NET MVC解决方案定义项目的标准做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该如何定义逻辑的ASP.NET MVC的解决方案?到我有多少项目,必须把我的解决方案?是否有此标准的做法?例如像,一个模型类图书馆,MVC的Web应用程序(包括控制器和放大器;查看),一个单元测试项目,一个项目库等...有哪些不同类型的项目之一,能拿出

How should I logically define an ASP.NET MVC solution? Into how many projects must I divide my solution? Is there a standard approach for this? Like for example, a model class library, an MVC web application (comprising controllers & views), a unit test project, a repository project etc... What are the different types of project one can come up with?

推荐答案

答案是真的取决于。取决于项目的规模。你可以拥有一切在一个项目(主MVC的),你可以进一步把它分解。该项目的法服形式是类似的东西:

The answer is really depends. Depends of the scale of your project. You can have it all in one project (main MVC one) of you can split it further. The canonic form for this projects is something like that:

project.WEB
project.Common (here belongs common functionality between projects, so helpers, utilities, even some extension methods belong there)
project.Model (Data entities)
project.BL //(Business Logic)
project.DAL //(Data Access Layer or Persistence)
project.Tests

*注意项目是您的命名空间的根。如何处理浩命名空间可以有一下:命名空间命名约定

而你可以越走越拆呢。不过我建议你不要使用任何进一步分裂它夸大。当你将不得不做,你就会知道(一个项目增加太多,有逻辑的分离......)。您尝试遵循的原则 YAGNI

And the you can split it further and further. However I would suggest that you do not exaggerate with splitting it any further. When you will have to do it you will know (one project grow too much, there are logic separations ...). You try to follow the principle YAGNI.

还有一件事。如果你想经书在那里检查出来DDD - 领域驱动德兴:的 http://msdn.microsoft.com/en-us/magazine/dd419654.aspx

And one more thing. If you want to be there "by the book" check it out DDD - Domain Driven Desing: http://msdn.microsoft.com/en-us/magazine/dd419654.aspx.

这篇关于是否有在ASP.NET MVC解决方案定义项目的标准做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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