简体   繁体   English

在ASP.NET MVC 3 Web应用程序项目之间共享视图

[英]Sharing views between ASP.NET MVC 3 Web application projects

I have several ASP.NET MVC 3 Web applications that have a lot of common objects: 我有几个具有许多常见对象的ASP.NET MVC 3 Web应用程序:

  • The same login controller. 相同的登录控制器。 The few differences between their login systems are captured in their web.config files. 他们的登录系统之间的一些区别记录在其web.config文件中。
  • Header/detail views: invoices, payment orders, payment orders, etc. 标头/明细视图:发票,付款单,付款单等。

In order to make my code less redundant, I moved common controllers and views to a separate class library (models were already in their own class libraries). 为了减少代码的冗余度,我将常见的控制器和视图移到了单独的类库中(模型已经在自己的类库中)。 After googling for a while, I eventually found out how to call controllers in external assemblies , however, I still don't know how to call views in external assemblies. 经过一段时间的搜索之后,我最终发现了如何在外部程序集中调用控制器 ,但是,我仍然不知道如何在外部程序集中调用视图。 How do I do that? 我怎么做?

You may want to look at MVCContrib Portable areas . 您可能需要看一下MVCContrib Portable区域 They allow you to compile an entire MVC application area into one assembly, including controllers, views and supporting files such as JavaScript and CSS. 它们使您可以将整个MVC应用程序区域编译为一个程序集,包括控制器,视图和支持文件(如JavaScript和CSS)。 I've worked on a large project that made extensive use of them and they work well, especially combined with T4MVC . 我参与了一个大型项目,该项目广泛使用了它们,并且效果很好,尤其是与T4MVC结合使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET MVC 和 Web API 共享类库项目 - ASP.NET MVC and Web API sharing Class Library Project 在本地网络中共享一个ASP.NET MVC应用程序 - Sharing an asp.net mvc application in local network 部署ASP.NET MVC 4 Web应用程序 - Deploy asp.net mvc 4 web application .Net桌面应用程序和ASP.NET Web应用程序之间的通信 - Communication between .Net Desktop Application and ASP.NET Web application 从我的asp.net mvc Web应用程序调用asp.net控制台应用程序 - Calling an asp.net console application from my asp.net mvc web application Asp.Net Web窗体应用程序的托管与Asp.Net MVC应用程序托管不同吗? - Does hosting for Asp.Net web forms application differ from Asp.Net MVC application? 在ASP.NET和Silverlight之间共享程序集 - Sharing an assembly between ASP.NET and Silverlight ASP.NET MVC2 VB.NET应用程序中的“标题”不是“ ASP.views…”的成员 - “ 'Title' is not a member of 'ASP.views … ” in ASP.NET MVC2 VB.NET Application 获取ASP.NET MVC Web应用程序以加载域中性 - Getting an ASP.NET MVC web application to load domain neutral 带有ASP.NET MVC 4和Angularjs的异步Web应用程序 - Asynchronous web application with ASP.NET MVC 4 and Angularjs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM