I really like the plugin architecture of WinForms and I want to use a plugin architecture in Asp.net.
I've searched for plugins architecture in asp.net and I've found asp.net MVC samples, but I want to use classic asp.net project not MVC.
Does anyone know of any resources for patterns using classic asp.net, not MVC?
You can roll your own.
A plugin architecture needs a few not-so-complex parts:
- A way to identify where the plugin dll is located
- An interface or base class definition that all plugins must adhere to. This is the most important one. It decides what functionality your plugin can expose and how deeply it can integrate with your app
- A place (in time) when your plugin gets loaded and executed. (ie, does the plugin execute for each web page request? Or for requests matching a certain name? Or does the page manually invoke plugins?)
Once you have this figured out, instantiating an instance of a plugin is simple. It works the same regardless of whether you're running in a web app or on the client:
System.Reflection.Assembly a = System.Reflection.Assembly.LoadFrom(plugin_path);
t = a.GetType("IPlugin");
IPlugin plugin = (IPlugin)Activator.CreateInstance(t);
then, you can use plugin.DoSomething()
to actually invoke functionality from the plugin. (Whether it is to render part of the html or save to a DB or whatever)
Look at Managed Extensibility Framework