473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Developing a plug-in type application

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.
Nov 16 '05 #1
3 1342
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" <ma************@honeywell.com> wrote in message
news:e9**************@TK2MSFTNGP12.phx.gbl...
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.

Nov 16 '05 #2
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" <ma************@honeywell.com> wrote in messagenews:e9**************@TK2MSFTNGP12.phx.gbl. ..> 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.>>

Nov 16 '05 #3
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.--

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Troy Erickson | last post by:
I am very new to web developing. What is the best way to create a web project. I will be using asp with vs.net. What do most people do for computers more specifically. Do I remote debug to a...
4
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I...
2
by: Thue Sørensen | last post by:
Hi. I would like to know if there is any known problems when developing .Net applications on Win2K. Problems that are gone when using XP. Or is everything exactly the same no matter if you...
5
by: Bill | last post by:
Good Day; I would appreciate assistance developing a query that I haven't been able to develop without using a second table. I wish to count the number of records that are still open on the...
0
by: Fergus Henderson | last post by:
"James Harris" <no.email.please> writes: >Can someone recommend a book that will teach me how to >approach C programming so that code is modularised, will compile >for different environments...
2
by: Kelvin | last post by:
To all, I've got another question. Does anybody know how to write plug-ins using VC++?? Actually, my friends and I will develop a Photo enhancing system, and so we'll need some technique to...
0
by: David Anthony | last post by:
Hello, Sorry if this has been answered before, but I can't find a definative answer. I have VS 2003 on my local machine, and a remote machine running Server2003. I want to develop for the remote...
3
by: Dexter | last post by:
Hello all, i want to know the best book about Developing Server Controls and Custom Web Controls with VB.NET. Thanks Dexter
4
by: Brad Markisohn | last post by:
Is there a way to determine, programmatically, when Plug-and-Play devices are connected or removed from the PC? In VB 6 I caught events from the SysInfo control, but I don't believe that this...
3
by: Rachelle | last post by:
I'm developing a webpage interface for the employees I work with that will allow them to search the database for things. I have everything else set up, but i'm having problems actually developing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.