PC Review


Reply
Thread Tools Rate Thread

Developing a plug-in type application

 
 
Sinex
Guest
Posts: n/a
 
      17th Mar 2005
Hi,
I want to build an application that triggers different algorithms. The
algorithms will be developed as class libraries over a period of time. I
want to just plug-in these libraries as and when they get developed. The
'interface' for all the algorithms will be same...only the implementation
keeps changing. The main application will make a decision at run time (based
on some parameters) as to which algorithm to use.
I want it to work this way:
1. I specify which library (algorithm) to use in the config file.
2. The application should load the corresponding library and call
the methods in it.
3. When a new algorithm is developed, I want to just add the
library(dll) to the GAC and add an entry in the config file...and the
application should be able to load this new dll if needed at run time.

I have some vague idea that this has to do with Reflection...but am not
able to get started. Will appreciate any comments on the design too...if
there are some standard patterns etc.


....Sinex.


 
Reply With Quote
 
 
 
 
Alexander Shirshov
Guest
Posts: n/a
 
      17th Mar 2005
Sinex,

Here's the easiest way I can think of:

* Define an interface
* Make your plugins implement it
* Create an instance of plugin at runtime using Activator class:

Type pluginType = Type.GetType("MyPlugin, MyPlugin"); // the can come from a
confing file.
IPlugin plugin = (IPlugin)Activator.CreateInstance(pluginType);

Few notes:
Read documentation on Type.GetType(string) carefully.
You might want to load plugins into a separate AppDomain, so they can be
unloaded when not needed.

HTH,
Alexander

"Sinex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I want to build an application that triggers different algorithms. The
> algorithms will be developed as class libraries over a period of time. I
> want to just plug-in these libraries as and when they get developed. The
> 'interface' for all the algorithms will be same...only the implementation
> keeps changing. The main application will make a decision at run time
> (based
> on some parameters) as to which algorithm to use.
> I want it to work this way:
> 1. I specify which library (algorithm) to use in the config file.
> 2. The application should load the corresponding library and call
> the methods in it.
> 3. When a new algorithm is developed, I want to just add the
> library(dll) to the GAC and add an entry in the config file...and the
> application should be able to load this new dll if needed at run time.
>
> I have some vague idea that this has to do with Reflection...but am not
> able to get started. Will appreciate any comments on the design too...if
> there are some standard patterns etc.
>
>
> ...Sinex.
>
>



 
Reply With Quote
 
Nick Malik [Microsoft]
Guest
Posts: n/a
 
      17th Mar 2005
See thes links:

Creating a Plug-In Framework
http://msdn.microsoft.com/asp.net/co...nframework.asp Search Dynamically for Plug-Ins http://msdn.microsoft.com/asp.net/co...ugins.asp----- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalikDisclaimer: Opinions expressed in this forum are my own, and notrepresentative of my employer. I do not answer questions on behalf of my employer. I'm just aprogrammer helping programmers.--"Sinex" <(E-Mail Removed)> wrote in messagenews:(E-Mail Removed)...> Hi,> I want to build an application that triggers different algorithms. The> algorithms will be developed as class libraries over a period of time. I> want to just plug-in these libraries as and when they get developed. The> 'interface' for all the algorithms will be same...only the implementation> keeps changing. The main application will make a decision at run time(based> on some parameters) as to which algorithm to use.> I want it to work this way:> 1. I specify which library (algorithm) to use in the config file.> 2. The application should load the corresponding library and call> the methods in it.> 3. When a new algorithm is developed, I want to just add the> library(dll) to the GAC and add an entry in the config file...and the> application should be able to load this new dll if needed at run time.>> I have some vague idea that this has to do with Reflection...but am not> able to get started. Will appreciate any comments on the design too...if> there are some standard patterns etc.>>> ...Sinex.>>

 
Reply With Quote
 
Nick Malik [Microsoft]
Guest
Posts: n/a
 
      17th Mar 2005
I have no idea why the formatting was so tossed.

Trying again...

Creating a Plug-In Framework
http://msdn.microsoft.com/asp.net/co...work.aspSearch Dynamically for Plug-Inshttp://msdn.microsoft.com/asp.net/community/authors/royosherove/default.aspx?pull=/library/en-us/dnaspp/html/searchforplugins.asp----- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalikDisclaimer: Opinions expressed in this forum are my own, and notrepresentative of my employer. I do not answer questions on behalf of my employer. I'm just aprogrammer helping programmers.--

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Developing Plug-Ins Joe Kovac Microsoft ASP .NET 8 6th Jun 2007 07:38 AM
Developing a WYSIWYG - IDE type application. How would you do it? iKiLL Microsoft Dot NET Framework Forms 22 28th Feb 2007 03:47 AM
Developing a WYSIWYG - IDE type application. How would you do it? iKiLL Microsoft Dot NET Compact Framework 22 28th Feb 2007 03:47 AM
Developing a WYSIWYG - IDE type application. How would you do it? iKiLL Microsoft C# .NET 22 28th Feb 2007 03:47 AM
Re: Developing Plug-ins Jonathan Kay [MVP] Windows XP Messenger 1 3rd Aug 2004 04:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:06 AM.