How to split an MVC project into multiple small MVC projects

I have an MVC 3 application that has some basic functionality (most importantly, authorization), but basically serves as a portal to different areas or modules. I want to organize this for different modules, which with minor modifications can also be deployed as their own website.

The project consists of a Forum mechanism, a blog, an exchange of messages between users + 4-5 future modules.

I looked at ScottGu's blog about MVC 2 and found what seemed to be perfect:

enter image description here

Depending on what the client needs, I only want to give them the exact modules they can use. In addition, from a maintenance point of view it is also easier to work and update the referencd assemblies in every project and just do a full update for clients who have this spesific module on their server.

But in MVC 3 there is no obvious way to use Areas this way, do you know how?

State I will try to add MVCContrib Portable scopes to my existing solution and transform my scopes and lay out the results. If it works, I will mark it as an accepted solution.

+3


source to share


2 answers


MVCContrib has portable areas.



http://mvccontrib.codeplex.com/wikipage?title=Creating%20a%20Portable%20Area&referringTitle=Documentation

+3


source


This is possible in MVC3: From: http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects



Right click on the shell project and "Add Area ...". Type in the area name. This will create an Areas folder with your area in it. (This is not 100% needed but you do need the "Areas" folder and you can steal the XXXXAreaRegistration class for your application.)

Create a new MVC3 empty project in your solution to match your area. Move the XXXXAreaRegistration.cs file from the shell mvc project to the new project and adjust the namespace as applicable. (Or you can manually create an area registration class, it a pretty simple class. Just use the Add area template generated one as an example.)

Edit the routes in the AreaRegistration folder as needed.

Delete the folder under the areas folder that the template wizard added.

Modify the web.config of the new project and take out the connection strings and the authentication, membership, profile, rolemanger sections. You will not need to deploy this web.config but the razor intellisense doesn't work without it during dev time.

Delete the global.asax file from the area project or you will get extra default routes.

Create a virtual directory in the "Areas" folder of the shell project with the name of your area as the alias and point it to your "area" project. You will need to use IIS or IIS Express for this. I use IIS. For IIS Express you can use the appcmd.exe in the IIS Express folder or you can edit the applciationhost.config file.
+1


source







All Articles