|
-
February 2nd, 2005, 06:58 AM
#1
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.
-
February 2nd, 2005, 07:10 AM
#2
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.
-
February 2nd, 2005, 07:11 AM
#3
-
February 2nd, 2005, 07:13 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|