asp.net MVC解决方案/项目布局 [英] asp.net MVC Solution/Project layouts

查看:130
本文介绍了asp.net MVC解决方案/项目布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是更加开放的问题,而不是寻找一个特定的答案。

This is more of an open question rather than looking for one specific answer.

大家都知道有一个适合所有的解决方案没有一个答案,但我很好奇,看看你如何组织你的ASP.NET MVC的解决方案和任何缺陷您可以在您的设计或事物,你会做不同所遇到的如果你可以重新开始。

As we all know there is no one answer that fits all solutions but I am curious to find out how you structure you asp.net MVC solutions and any pitfalls you may have come across in your design or things that you would do differently if you could start again.

标准asp.net MVC模板仅仅是一个基本的模板,我敢肯定,我已经读/听到一个播客,斯科特Hanselman的规定的唯一原因模型文件夹是有这样的人没有问哪来的模型。这已经意味着,也许它应该被移动到自己单独的类。

The standard asp.net MVC template is just a basic template and I'm sure I've read/heard in a podcast that Scott Hanselman stated the only reason the Model folder is there is so people didn't ask where's the model. This already implies that maybe it should be moved to its own separate class.

个人在小MVC应用程序我已经做了我已经分离出来的模型转换成其唯一的类,用于保存模型和存储库,而MVC项目有控制器和意见。这有一般的锻炼,没有任何问题,但正如我所说,这些都只是小了应用。

Personally in the small MVC apps I've done I've separated out the model into its only class that holds the model and the repository while the 'MVC' project has the controller and the views. This has generally workout without any issues but as I said these have only been small apps.

那么,什么是大多数人在做什么?
  - 只需使用标准模板吗?
  - 分离出只是模型?
  - 分离出模型和控制器?
  - 分离出即使是通过Web服务或某种数据门户的移动,所有的数据访问是做什么?
  - ?还是完全不同的东西。

So what are most people doing? - Just using the standard template? - Separating out just the model? - Separating out the model and the controller? - Separating out even move so all the data access is done through web services or some sort of data portal? - Or something totally different?

最后如何人民创造的单元测试?仅一个单元测试类,测试每个项目或一个单元测试类每个项目的?

Finally how are people creating unit tests? Just one unit test class that test each of the projects or a unit test class for each project?

推荐答案

我个人使用吉米·博加德的做法:<一href=\"http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/12/08/organizing-asp-net-mvc-solutions.aspx\"相对=nofollow>组委会ASP.NET MVC解决方案。

Personally I use Jimmy Bogard's approach: Organizing ASP.NET MVC solutions.

这篇关于asp.net MVC解决方案/项目布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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