Plugin/Api in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Boesch

    #1

    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



  • Michael Mayer

    #2
    Re: Plugin/Api in C#

    Jon Skeet just wrote up a nice article about plugins. Hopefully it answers
    your questions:
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.


    --
    Mike Mayer

    mike@mag37.com


    "Roger Boesch" <roger.boesch@m ultihull.ch> wrote in message
    news:3f53c5c9_4 @news.bluewin.c h...[color=blue]
    > Im currently working on a plugin architectur for a software product[/color]
    written[color=blue]
    > 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[/color]
    (callback)[color=blue]
    >
    > 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.[/color]
    to[color=blue]
    > make the classes known to the project plugin and the
    > project interface. But this is not poss. because i cannot make any[/color]
    reference[color=blue]
    > to the app because this is an exe.
    >
    > What must i do, that the interface and the plugin knows about the classes[/color]
    in[color=blue]
    > the app ?
    >
    > Thanks for any help
    >
    >
    > Roger
    >
    >
    >[/color]


    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: Plugin/Api in C#

      Roger,
      Use the Separated Interface Pattern:

      Defines an interface in a separate package from its implementation.


      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).

      A well-known object that other objects can use to find common objects and services.


      Hope this helps
      Jay

      "Roger Boesch" <roger.boesch@m ultihull.ch> wrote in message
      news:3f53c5c9_4 @news.bluewin.c h...[color=blue]
      > Im currently working on a plugin architectur for a software product[/color]
      written[color=blue]
      > 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[/color]
      (callback)[color=blue]
      >
      > 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.[/color]
      to[color=blue]
      > make the classes known to the project plugin and the
      > project interface. But this is not poss. because i cannot make any[/color]
      reference[color=blue]
      > to the app because this is an exe.
      >
      > What must i do, that the interface and the plugin knows about the classes[/color]
      in[color=blue]
      > the app ?
      >
      > Thanks for any help
      >
      >
      > Roger
      >
      >
      >[/color]


      Comment

      • Roger Boesch

        #4
        Re: Plugin/Api in C#

        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]" <Jay_Harlow@ema il.msn.com> schrieb im
        Newsbeitrag news:uBriCmNcDH A.1044@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Roger,
        > Use the Separated Interface Pattern:
        >
        > http://www.martinfowler.com/eaaCatal...Interface.html
        >
        > Define an interface that your Application implements, put this interface[/color]
        in[color=blue]
        > 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" <roger.boesch@m ultihull.ch> wrote in message
        > news:3f53c5c9_4 @news.bluewin.c h...[color=green]
        > > Im currently working on a plugin architectur for a software product[/color]
        > written[color=green]
        > > 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[/color]
        > (callback)[color=green]
        > >
        > > Project c) Interface: Describes the plugin
        > >
        > > As long as i only use standard c# types in my plugin and interface, its[/color][/color]
        no[color=blue][color=green]
        > > problem.
        > > but when i will access on objects in the application, its of course[/color][/color]
        necc.[color=blue]
        > to[color=green]
        > > make the classes known to the project plugin and the
        > > project interface. But this is not poss. because i cannot make any[/color]
        > reference[color=green]
        > > to the app because this is an exe.
        > >
        > > What must i do, that the interface and the plugin knows about the[/color][/color]
        classes[color=blue]
        > in[color=green]
        > > the app ?
        > >
        > > Thanks for any help
        > >
        > >
        > > Roger
        > >
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...