Reuse an MVC area in multiple MVC applications?

自闭症网瘾萝莉.ら 提交于 2019-12-09 12:20:10

问题


I have some common web pages that will be in multiple MVC applications. For those pages I'd like to reuse the same source code (controllers + views) between the different MVC web sites. What is the best way to go about doing this?

ASP.NET MVC areas seem like one possibility but they just a sub directory of the website project. Is it possible to reuse an MVC area in multiple MVC applications?


回答1:


You could embed views into assemblies and implement a custom VirtualPathProvider.




回答2:


Look at "portable areas."

http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx



来源:https://stackoverflow.com/questions/2840302/reuse-an-mvc-area-in-multiple-mvc-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!