By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

C# - Plugin Design

P: n/a
I'd like to build a C# application that has some sort of plugin or
additional modules depending on what functionality the client user has
requested.

The idea is that I have an SQL database table that can be updated from a
number of different sources [3rd party databases/applications] for example:

ID Source SomeData
== ====== =========
1 SomeSQLDatabase.dll abc
2 SomeFlatFileDatabase.dll xyz

Each plugin/module would support the same functions such as:

Find(string userToFind);
Update(ref CustomObject rowInDatabase);

etc. and thus a plugin/module could be used for updating a particular
record in the database depending on the source i.e psudo code:

foreach (file dllfile in directory)
{
if (file.Name == "SomeFlatFileDatabase.dll")
{
foreach (record in database with source = "SomeFlatFileDatabase.dll")
{
[SomeFlatFileDatabase.dll.]Update();
}
}
}

Both the main application and the plugins/modules would reference
another dll containing some custom collections etc.

Also is it possible to add the plugins/modules to a directory within my
applications installed directory without having to add the dll reference
i.e. duplicting the copy that would already be in the installation
directory as part of the main application.

I know this is possible, but I'm just not sure on the best way to start
designing this componant of my application. Could someone perhaps point
me in the right direction or give any hints and tips?

Many thanks in advance. If you need me to clarify anything then let me know.

Regards,

Richard
Sep 21 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Richard,

What you're looking for is called "Reflection".

You can look at this article at TCP :
http://www.codeproject.com/csharp/PluginsInCSharp.asp

There's source code and explanation about the same thing you want.

Greetings,
- S. Lorétan

"Richard" <fa*****@hotmail.co.uka écrit dans le message de news:
J5********@bath.ac.uk...
I'd like to build a C# application that has some sort of plugin or
additional modules depending on what functionality the client user has
requested.

The idea is that I have an SQL database table that can be updated from a
number of different sources [3rd party databases/applications] for
example:

ID Source SomeData
== ====== =========
1 SomeSQLDatabase.dll abc
2 SomeFlatFileDatabase.dll xyz

Each plugin/module would support the same functions such as:

Find(string userToFind);
Update(ref CustomObject rowInDatabase);

etc. and thus a plugin/module could be used for updating a particular
record in the database depending on the source i.e psudo code:

foreach (file dllfile in directory)
{
if (file.Name == "SomeFlatFileDatabase.dll")
{
foreach (record in database with source = "SomeFlatFileDatabase.dll")
{
[SomeFlatFileDatabase.dll.]Update();
}
}
}

Both the main application and the plugins/modules would reference another
dll containing some custom collections etc.

Also is it possible to add the plugins/modules to a directory within my
applications installed directory without having to add the dll reference
i.e. duplicting the copy that would already be in the installation
directory as part of the main application.

I know this is possible, but I'm just not sure on the best way to start
designing this componant of my application. Could someone perhaps point me
in the right direction or give any hints and tips?

Many thanks in advance. If you need me to clarify anything then let me
know.

Regards,

Richard

Sep 21 '06 #2

P: n/a
Hi,

It's easily done, take a look at Jon's article about it:

http://www.pobox.com/~skeet/csharp/plugin.html


"Richard" <fa*****@hotmail.co.ukwrote in message
news:J5********@bath.ac.uk...
I'd like to build a C# application that has some sort of plugin or
additional modules depending on what functionality the client user has
requested.

The idea is that I have an SQL database table that can be updated from a
number of different sources [3rd party databases/applications] for
example:

ID Source SomeData
== ====== =========
1 SomeSQLDatabase.dll abc
2 SomeFlatFileDatabase.dll xyz

Each plugin/module would support the same functions such as:

Find(string userToFind);
Update(ref CustomObject rowInDatabase);

etc. and thus a plugin/module could be used for updating a particular
record in the database depending on the source i.e psudo code:

foreach (file dllfile in directory)
{
if (file.Name == "SomeFlatFileDatabase.dll")
{
foreach (record in database with source = "SomeFlatFileDatabase.dll")
{
[SomeFlatFileDatabase.dll.]Update();
}
}
}

Both the main application and the plugins/modules would reference another
dll containing some custom collections etc.

Also is it possible to add the plugins/modules to a directory within my
applications installed directory without having to add the dll reference
i.e. duplicting the copy that would already be in the installation
directory as part of the main application.

I know this is possible, but I'm just not sure on the best way to start
designing this componant of my application. Could someone perhaps point me
in the right direction or give any hints and tips?

Many thanks in advance. If you need me to clarify anything then let me
know.

Regards,

Richard

Sep 21 '06 #3

P: n/a
S,
What you're looking for is called "Reflection".

You can look at this article at TCP :
http://www.codeproject.com/csharp/PluginsInCSharp.asp

There's source code and explanation about the same thing you want.
Thanks that is exactly what I wanted. Built my own test and it works a
treat. Now I can work on my pukka application.

Cheers,

Richard
Sep 22 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.