473,396 Members | 1,864 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.

C# - Plugin Design

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
3 4362
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: S³awomir Marcinkowski | last post by:
Hello, can someone show use example use smarty pager plugin? {pager rowcount=$LISTDATA.rowcount limit=$LISTDATA.limit txt_first=$L_MORE class_num="fl" class_numon="fl" class_text="fl"} I'm...
7
by: Reinhold Birkenfeld | last post by:
Hello, another philosophical question: How would you implement a plugin system (for a web-based application)? Conditions are: - One plugin can have one or many "parts" (or "subplugins", or...
2
by: timtos | last post by:
Hello. I don´t know if this is a totally silly questin because I really don´t know much about the topic. So excuse me if I am wrong. I want to write a plugin for microsoft office. In fact I...
3
by: JJ | last post by:
Hi all, I'm writing a program that uses plugins to add some functionality. It works as follows: A plugin is a user control with a method getCoordArray(decimal inX, decimal inY, decimal inZ) and...
2
by: Matt | last post by:
I'm hoping someone can steer me in the right direction to try to do the following: I am developing an application where we receive files from customers. Right now we receive a variety of...
2
by: Joe_Black | last post by:
Hi all, I want to create an MDI app that allows reporting on XML data files downloaded from the equipment that we manufacture, this MDI app will have several default reports but due to the...
4
by: Paciente8159 AKA Klayman | last post by:
Hi, I have a couple of doubts reggarding a plugin based application in C++? I want to build a c++ plugin based app. I have searched alot of things in the net but I still don't know how to...
0
by: Zeya | last post by:
Situation: Using C#, ASP.Net Requirement: 1. ASP.net application with virtual hosting service. 2. Requires a service that will run every predefined frequency in minutes (2, 30, 100, 10000)...
3
by: =?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?= | last post by:
I'm working on my little project (an IM client) which I wanted to support plugins. My idea was that the core program would by itself do virtually nothing but manage plugins and all functionality...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.