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.
1:file upload working in one and not the other helpSetting a default value — presentation logic or business logic?Suggestions/Recommendations for a Web Application with Sub-Apps
2:Dynamic content in static content
How to define route & controller structure for 2 controllers?
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]
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.