Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How best to reuse MVC3 controller/views in multiple apps?

I am rewriting some old ASP applications that were not well structured and trying to learn .NET and MVC3 in the process. There are two main applications, one of which reuses code from the other and is really just a very limited version of the other one. One provided "power" users with reports on any person in the database. The other one provided a report only on the individual requesting the report. These are on separate servers, the more limited one in a DMZ and the more powerful one behind a second firewall.

My question is, since the actual report is the same for both, just parameterized for the more powerful one to allow it to be run on any user, I do NOT want to copy-and-paste reuse the report generation from one side to the other. I would like to make some kind of reusable library of the controller and views/partials that would provide the same information, and allow me to maintain it all in one place.

Is this possible with MVC3? Or is there a better approach? I searched here a bit but didn't find anything on this, but maybe I just didn't use the right terms.

I'm on VS2010, C#, MVC3 with Razor.

Thanks in advance.

like image 771
Dave Avatar asked Oct 31 '11 20:10

Dave


1 Answers

MVC Contrib project has portable areas.

http://mvccontrib.codeplex.com/documentation

like image 180
Dmitry S. Avatar answered Nov 13 '22 19:11

Dmitry S.