HighTechTalks DotNet Forums  

Plugin Architecture

Dotnet Framework microsoft.public.dotnet.framework


Discuss Plugin Architecture in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
kris
 
Posts: n/a

Default Plugin Architecture - 12-27-2007 , 11:16 PM






hello all

i am trying to make a pluggable application which can use plugin dll
savailable at some particular folder. i have searched for samples on the net
and have found some but am not very clear. if any of you can help me with an
easy example that would help me a lot.

thanks and regards
krish



Reply With Quote
  #2  
Old   
Michael Nemtsev [MVP]
 
Posts: n/a

Default Re: Plugin Architecture - 12-28-2007 , 08:47 AM






Hello kris,

How did u search?

http://search.live.com/results.aspx?...n+architecture


---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


k> hello all
k>
k> i am trying to make a pluggable application which can use plugin dll
k> savailable at some particular folder. i have searched for samples on
k> the net and have found some but am not very clear. if any of you can
k> help me with an easy example that would help me a lot.
k>
k> thanks and regards
k> krish



Reply With Quote
  #3  
Old   
Jim Rand
 
Posts: n/a

Default Re: Plugin Architecture - 12-28-2007 , 09:54 AM



Create and interface and implement it.

"kris" <krishm18 (AT) yahoo (DOT) com> wrote

Quote:
hello all

i am trying to make a pluggable application which can use plugin dll
savailable at some particular folder. i have searched for samples on the
net and have found some but am not very clear. if any of you can help me
with an easy example that would help me a lot.

thanks and regards
krish




Reply With Quote
  #4  
Old   
Fredo
 
Posts: n/a

Default Re: Plugin Architecture - 12-29-2007 , 10:41 AM



There are a bunch of ways to do plugin architectures which can make it
somewhat confusing, and it really depends what your specific needs are.

Here's a sort of general method to do it that I've used a few times:

First, I create a plugin library DLL. This basically contains interfaces
I've defined that the application and plugins will implement. Both the main
application and the plugin DLLs reference this library.

Some examples of interfaces are: IApplication (this is implemented by the
application itself and contains methods that the plugin can call to get
information from the application) and IPlugin (which is, obviously,
implemented by a plugin).

There is then some sort of Initialize() method in the IPlugin interface that
takes an IApplication parameter.

The application then loads all the DLLs, probably through Assembly.LoadFrom
or some similar method and searches for DLLs that implement the IPlugin
interface (using reflection). The application then creates instances of each
of these IPlugin implementors and follows that by calling Initialize() and
passing the IApplication implementor.

Now you have an application and plugins that can speak to each other. You
simply need to define the methods in IApplication and IPlugin that are
necessary to do whatever communication you need between the two.

There are a number of variations to this. You might want to use some sort of
configuration file to tell you what DLLs to load instead of searching for
IPlugin implementations. But the basic strategy above makes for a pretty
minimal implementation that's easy to work with.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.