Share MVC application functionality

Share MVC application functionality

I have built and application in ASP.NET MVC, which started out orignally as a way to learn the technology. However, the application (and my knowledge of MVC) have progressed and I would like to use parts of the functionality I have created in other applications. Eg I would have 2 websites both wanting to use the same News Control (CRUD) model and controller methods, but with their own unique Views. I suppose my questions are: 1. Is this going against the principles of MVC? 2. What is the best way to achieve this? 3. Is there a "best practise" way to re-use my exisiting functionality?

Thanks in advance for any answers.

How to redirect if javascript is disabled in mvc masterpage


file upload working in one and not the other help
Depending on your exact requirements I'd recommend you take a look at Rob Ashton's series on multi-tenancy in ASP.Net MVC, and also the portable areas part of MVC Contrib..
Can classic asp and ASP.NET MVC run side-by-side on the same site?

Setting a default value — presentation logic or business logic?

Suggestions/Recommendations for a Web Application with Sub-Apps


Dynamic content in static content
You could setup a Visual Studio solution in which you would have a common class library project containing models, controllers and data access and two web applications containing only the views and CSS of the two sites both referencing the same controllers and models..
Id with / causes problems with routing [duplicate]

How to define route & controller structure for 2 controllers?


Hopefully most of your logic is already separated out, but you can also pull your controllers out to a separate assembly, I believe:.


Reuse is a really central part to the concept of MVC.

It's very common in production MVC sites to have a separate assembly (or assemblies) for the Model.

It's somewhat less common (but still done) to do the same for Controllers.

The S#harp architecture project (for example) uses a separate assembly for everything, leaving just views, content, and global.asax in the Web assembly.

It's all good.. Another thing you might consider is the use of Areas, which are like mini-MVC apps that you can reference in your 'main' app.

It's a great way to package reusable pieces like you describe.. Paul.

53 out of 100 based on 18 user ratings 343 reviews