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

Plugin/Api in C#

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.