4

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?

3
  • There is no standard plug-in architecture per se. MEF (as Jan Remunda pointed out) is one option but it could be an overkill in some cases. What would you like to be able to do exactly. Commented Mar 9, 2011 at 7:26
  • 1
    Especialyl given that there IS NO PLUGIN ARCHTIECTURE IN WINFORMS. What are you talking abuot? Commented Mar 9, 2011 at 7:33
  • i wan to use plugin architecture in ASP.NET without asp.net mvc 1-2-3 Commented Mar 9, 2011 at 7:44

2 Answers 2

15

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)

Sign up to request clarification or add additional context in comments.

2 Comments

can you give some useful sample link in asp.net
Why re-invent the wheel & write boilerplate code like that when there are so many perfectly capable libraries out there?
3

Look at Managed Extensibility Framework

4 Comments

without MEF can i do that? i am using vs 2008
yes, with reflection (as HS writes), but you have to write your own logic. MEF is better solution if you have bigger apllication with many components.
i want to use this solution in my project : stackoverflow.com/questions/236972/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.