CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Plugins in .NET?

    Hi,

    I'm new to .NET (coming from C++) and I would like to design a pluggable architecture for the application. Basically, it should work something along the lines of:
    - Main executable
    - plugin dlls that can be installed/uninstalled separately

    The requirement for the plugins would be that they implement certain interfaces (easy), but they could also have a UI part that would then be integrated into the main UI. This should work a bit like OLE Property pages in C++/COM, but it would be great if it could be done wholly in .NET and not requiring any interop with COM. The basic reasoning is that it should be able to run on Mono as well.

    Are there any examples of this kind of architecture in C#, or how would I go about designing this and actually implementing it?

    Thanks in advance,

    Yves
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Plugins in .NET?

    Have a look at the reflection namespace with details about how to create classes from dynamcially loaded assemblies.

    Assembly.LoadFile loads an assembly into memory from a file, and then you can just reflect on the types in that assembly and create instances of whichever ones you like.

    I'd have a look at custom attributes as well because they really come into their own when doing this sort of thing.

    If you look at my article about the MDI template in .NET you'll see I attach a 'Document' attribute to the document types so reflection can pick them out of the assembly.

    Also the UI stuff you're talking about is considerably easier in .NET than in C++ : you can just create a control using it's constructor (again using reflection) and then just attach it to whichever form you want to. No nasty mucking about with the ActiveX mechanisms and callback methods here ! Just straight in and use.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

  4. #4
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Plugins in .NET?

    Great, thanks to both of you. I'm in for a bit of reading
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured