ASP.NET MVC - 分离大应用 [英] ASP.NET MVC - separating large app

查看:92
本文介绍了ASP.NET MVC - 分离大应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直不解我认为自相矛盾的说法:ASP.NET MVC声称是促进和支持口号是关注分离,我觉得这一个伟大的想法

I've been puzzled by what I consider a contradiction in terms: ASP.NET MVC claims to be furthering and supporting the "separation of concern" motto, which I find a great idea.

但是,似乎也没有分离出的控制器,模型或视图到自己组装,或分离地区进入组件的方式。

However, it seems there's no way of separating out controllers, model or views into their own assembly, or separating areas into assemblies.

通过固定控制器模式查看在ASP.NET MVC的文件夹,你实际创建的事情了巨大的杂牌波奇。是关注点分离,真的吗?好像恰恰相反给我。

With the fixed Controller, Model and View folders in your ASP.NET MVC, you're actually creating a huge hodge podge of things. Is that the separation of concerns, really?? Seems like quite the contrary to me.

所以,我想知道:


  • 我怎么可以创建一个ASP.NET MVC解决方案,要么分离出来的控制器,模型和文件夹的完全的意见,为独立的组件?

  • how can I create an ASP.NET MVC solution that will either separate out controllers, the model, and the folders full of views, into separate assemblies?

我怎么可以把ASP.NET MVC 2的区域划分为单独的程序集?

how can I put areas of ASP.NET MVC 2 into separate assemblies?

或怎么回事,你管理一个大的ASP.NET MVC应用程序 - 其中有几十甚至百余控制器,大量的模型和视图模型类,几百看法?

or how else do you manage a large ASP.NET MVC app - which has several dozen or even over a hundred controllers, lots of model and viewmodel classes, and several hundred views?

推荐答案

我认为你正在寻找<一href=\"http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-$p$pview-1-released.aspx\">Areas在ASP.Net MVC 2 。有一些东西在的csproj文件注释,但之后它会复制,当您建立过意见。我不认为这是该控制器模式类在同一个装配为一体的看法的任何要求。

I think you're looking for Areas in ASP.Net MVC 2. There are some things to uncomment in the CSProj files, but after that it will copy the views over when you build. I don't think there is any requirement that the Controller or Model classes be in the same assembly as the views.

演练:创建一个ASP.NET MVC应用领域中使用多个项目

这篇关于ASP.NET MVC - 分离大应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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