473,383 Members | 1,892 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,383 software developers and data experts.

Plugin/Api in C#

Im currently working on a plugin architectur for a software product written
in c# and have found the following problem:

Project a) Application, Application with all classes used in this app

Project b) Plugin which will access to objects in the application (callback)

Project c) Interface: Describes the plugin

As long as i only use standard c# types in my plugin and interface, its no
problem.
but when i will access on objects in the application, its of course necc. to
make the classes known to the project plugin and the
project interface. But this is not poss. because i cannot make any reference
to the app because this is an exe.

What must i do, that the interface and the plugin knows about the classes in
the app ?

Thanks for any help
Roger

Nov 15 '05 #1
3 2007
Jon Skeet just wrote up a nice article about plugins. Hopefully it answers
your questions:
http://www.pobox.com/~skeet/csharp/plugin.html

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"Roger Boesch" <ro**********@multihull.ch> wrote in message
news:3f********@news.bluewin.ch...
Im currently working on a plugin architectur for a software product written in c# and have found the following problem:

Project a) Application, Application with all classes used in this app

Project b) Plugin which will access to objects in the application (callback)
Project c) Interface: Describes the plugin

As long as i only use standard c# types in my plugin and interface, its no
problem.
but when i will access on objects in the application, its of course necc. to make the classes known to the project plugin and the
project interface. But this is not poss. because i cannot make any reference to the app because this is an exe.

What must i do, that the interface and the plugin knows about the classes in the app ?

Thanks for any help
Roger

Nov 15 '05 #2
Roger,
Use the Separated Interface Pattern:

http://www.martinfowler.com/eaaCatal...Interface.html

Define an interface that your Application implements, put this interface in
Project C with the interface for the plugin. The implementation of course
will be in Project A.

Either define the constructor or a method of the plugin interface to allow
the application to register the IApplication interface with the plugin.
Alternatively you can use a variation of the Registry pattern to register
the application with some object in Project C. (In this case it would look
more like a Singleton that can be set by the Project A).

http://www.martinfowler.com/eaaCatalog/registry.html

Hope this helps
Jay

"Roger Boesch" <ro**********@multihull.ch> wrote in message
news:3f********@news.bluewin.ch...
Im currently working on a plugin architectur for a software product written in c# and have found the following problem:

Project a) Application, Application with all classes used in this app

Project b) Plugin which will access to objects in the application (callback)
Project c) Interface: Describes the plugin

As long as i only use standard c# types in my plugin and interface, its no
problem.
but when i will access on objects in the application, its of course necc. to make the classes known to the project plugin and the
project interface. But this is not poss. because i cannot make any reference to the app because this is an exe.

What must i do, that the interface and the plugin knows about the classes in the app ?

Thanks for any help
Roger

Nov 15 '05 #3
Thanks for all the hints and tips.
I have split now the whole application in diff. dll's and some bas classes
and the interface
in one base.dll. Communication is done over interfaces and so it works fine.

Thanks again.

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> schrieb im
Newsbeitrag news:uB**************@TK2MSFTNGP10.phx.gbl...
Roger,
Use the Separated Interface Pattern:

http://www.martinfowler.com/eaaCatal...Interface.html

Define an interface that your Application implements, put this interface in Project C with the interface for the plugin. The implementation of course
will be in Project A.

Either define the constructor or a method of the plugin interface to allow
the application to register the IApplication interface with the plugin.
Alternatively you can use a variation of the Registry pattern to register
the application with some object in Project C. (In this case it would look
more like a Singleton that can be set by the Project A).

http://www.martinfowler.com/eaaCatalog/registry.html

Hope this helps
Jay

"Roger Boesch" <ro**********@multihull.ch> wrote in message
news:3f********@news.bluewin.ch...
Im currently working on a plugin architectur for a software product written
in c# and have found the following problem:

Project a) Application, Application with all classes used in this app

Project b) Plugin which will access to objects in the application

(callback)

Project c) Interface: Describes the plugin

As long as i only use standard c# types in my plugin and interface, its no problem.
but when i will access on objects in the application, its of course

necc. to
make the classes known to the project plugin and the
project interface. But this is not poss. because i cannot make any reference
to the app because this is an exe.

What must i do, that the interface and the plugin knows about the

classes in
the app ?

Thanks for any help
Roger


Nov 15 '05 #4

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

Similar topics

2
by: Rudolf | last post by:
Dear NG, I want to create a Plugin System in C# (WinForms). Has anybody experience about this, tips, tricks, or any links. Thank you very much The DotNetJunkie
2
by: Edvard Majakari | last post by:
Hi, My idea is to create a system working as follows: each module knows path to plugin directory, and that directory contains modules which may add hooks to some points in the code. Inspired...
0
by: Edvard Majakari | last post by:
Hi, My idea is to create a system working as follows: each module knows path to plugin directory, and that directory contains modules which may add hooks to some points in the code. Inspired...
2
by: Ron | last post by:
Hello, I'm attempting to develop a plugin framework for an application that I'm working on. I wish to develop something in which all plugins exist in a directory tree. The framework need only...
7
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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...

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.