Sharing views between ASP.NET MVC 3 Web applicatio

2019-03-20 19:21发布

I have several ASP.NET MVC 3 Web applications that have a lot of common objects:

  • The same login controller. The few differences between their login systems are captured in their web.config files.
  • 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?

1条回答
神经病院院长
2楼-- · 2019-03-20 19:46

You may want to look at MVCContrib Portable areas. They allow you to compile an entire MVC application area into one assembly, including controllers, views and supporting files such as JavaScript and CSS. I've worked on a large project that made extensive use of them and they work well, especially combined with T4MVC.

查看更多
登录 后发表回答