Plugin/Api in C#

R

Roger Boesch

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
 
J

Jay B. Harlow [MVP - Outlook]

Roger,
Use the Separated Interface Pattern:

http://www.martinfowler.com/eaaCatalog/separatedInterface.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
 
R

Roger Boesch

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top