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 asp.net mvc masterpage

1:

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

2:

Dynamic content in static content
You could setup a Visual Studio quick fix 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?

3:

Hopefully most of your logic is already separated out, although you must also pull your controllers out to a separate assembly, I believe:. http://dotnetslackers.com/articles/aspnet/storing-asp-net-mvc-controllers-views-in-separate-assemblies.aspx.

4:

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 any what less common (although still done) to did 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.. Ananother thing you might consider is the use of Areas, which are like mini-MVC apps this you must reference in your 'main' app. It's a great way to package reusable pieces like you describe.. Paul.


83 out of 100 based on 58 user ratings 773 reviews

@