[Mono-list] A Plugin and WebService Issue
Thu, 20 May 2004 12:36:18 +0200
I would use this approach:
1) you must have a plug-in Interface defined, that each plug-in must
2) when the application starts, use static =
method to get the names of assemblies in the plug-in directory
3) for each plug-in-assembly file call static
System.Reflection.Assembly.LoadFrom() method to load the assembly into =
current AppDomain, then call the method
System.Reflection.Assembly.GetTypes() on the System.Reflection.Assembly
instance that you've got from the previous LoadFrom() method
4) for each Type that you get from previous GetType() method use the =
operator to check if the particular type implements the plug-in =
if it does, you have a type that implements your plug-in interface.=20
5) call static Syste.Activator.CreateInstance() method with the type =
previous step as parameter. Cast the result to the plug-in-interface =
and store it for example in an array for later use.
6) now you have an array of plug-in instances and can call the interface
methods on them
This is just an example, there are several other approaches which are =
or less similar to this one... everything depends on the needs of your
Quoting Pablo Fischer <firstname.lastname@example.org>:
> I would like to have some comments and suggestions about a issue.
> I am working in a Blog Client (mbloggy) that will work ONLY in SOAP =
> XMLRPC) for different CMS and Blogs (phpnuke, postnuke, jaws, etc, =
> To work with all these blogs I'm=A0 planning to use a 'plugin' system,
> based in assemblies, for example:
> If a developer wants the plugin for a CMS (like drupal), he can save =
> .dll plugin in ~./mbloggy/plugins and when mbloggy starts it will read
> default plugins (in /etc/mbloggy) and the user plugins. When mbloggy
> finds a new plugin it will be added to a 'drop down' (gtk#) so the =
> can use it.
> My problem?, yes, I don't know which is the best option:
> a) Use .dll assemblies as plugins. But, how to connect to each plugin
> from the front end?, exists a data type that can 'clone' another
> object?, so I can do something like this:
> Wrapper wrap =3D new Wrapper();
> wrap.Url =3D "http://www.foo.bar.com/foo.aspx?wsdl"
> So I can use the 'methods' of assemblie.dll in the wrap object?.
> b) Or use just one .dll and let the developers to 'develop' just the
> WebService (server)?, So I can just work like this:
> Client c =3D new Client();
> c.Url =3D "http://www.foo.bar.com/foo.aspx?wsdl"
> Which is the best option? and where can I find more information for =
> best option?.
> Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
> Fingerprint:=A0 5973 0F10 543F 54AE 1E41=A0 EC81 0840 A10A 74A4 E5C0