views:

487

answers:

3

Introduction: Now I know this question could be very broad and it would be too hard to answer without me asking something specific. So All I ask is just some direction, or a brief high level explanation of a design, or maybe there is already some framework out there that could help me get started...I'm not sure.. I have never designed a plugin architecture before, so maybe there is some resource/example you could point me to on the web that would help me learn so that I may come up with my own solution.

Details of my question: My intention is I would like to create a plug-in architecture for a new pet-project that I am building in ASP.NET MVC.

I would like to design it so that it has some sort of plug-in ability for all, or at least most, of the application's components.

The reason I would like to do this, is so that I may be able to do deployments with nearly zero down time. The idea is that when I want to deploy the latest version I would drop in the new DLLs into a specific folder, and the application would load up the new plug ins and that is it.

For exapmle, lets say I add a new "contacts" feature to my web application where users can search, add and delete contacts. I would like to be able to deploy that by way of plugins.

Is something like this even possible for Web Applications? Or am I just dreaming?

+2  A: 

It's definitely possible.

You will need to define a pretty comprehensive interface that represents everything your plugins will have to do. You should approach it by differentiating what is "core" to your application, and where the extensibility points are. For example, where will the plugins be accessed? Will they be tabs on a page, or links in a sidebar? What properties does each plugin need to have in order to fit into the plugin container?

Generally, plugins are enumerated via reflection by looking for assemblies that implement the plugin interface.

Just for encouragement, we've done this with an enterprise product that provides a generic framework for "management" interfaces for web sites. Developers just need to drop in a plugin dll that builds specific property pages, and they show up in the management interface menu, all the navigation is taken care of, and their dll's just have to worry about their own domain logic.

womp
+1  A: 

There is always the dll-way where you define some interfaces that plugins follow.

But for web application, especially ASP.NET MVC, you need a controller, views and so. Probably these can be included in a dll file using prepared controller factory to handle that, but it would be hard to develop these plugins. Some inspiration for code (or db) embedded content: Haacked about that

ASP.NET MVC version 2 will support areas, where you can put some parts of the application into different folders within the app. This way you can just upload some files and the app will recognize these new files. Read more there Haacked blog

twk
A: 

PS: I found another person here on S.O. asking the same question as me: http://stackoverflow.com/questions/340183/plug-in-architecture-for-asp-net-mvc It might be useful for someone researching the same topic.

Roberto Sebestyen