ApplicationDomains

J

Jody L. Whitlock

Can someone assist me in this quest? I've been trying in vein for some
time now to figure out how to use AppDomains as a way of making a
plugin architecture. Basically, here's my plan:

1) Load main assembly
2) Create new appdomain to "discover" all plugins and report them back
to the main assembly
3) Destroy discovery domain (To free assemblies/resources)
4) Create new appdomain and load advertised plugins into it

Now, the reason for this is so that if I have a new plugin, I can
destroy the plugin appdomain, start with step 2, and reload the new
plugins without having to reload the main assembly. So, I need to
learn how to do a couple of things:
A) Pass objects between appdomains
B) Call methods in my plugins from my main assembly

I plan to use this in a service project, basically all the
functionality of the service is in the plugins, with the main assembly
basically being a loader. This has been requested because one of the
DLL's the service uses has to be modified every 30 days, so the boos
wants to do this without having to shut down the service. he can live
with a few seconds interruption.
I plan on leaning heavily on a method I made that resembles CallByName,
plus some static methods. I also plan on using this in one of my
WinForm apps, making a custom MenuItem object that will also contain
the method to execute.
Here's the kicker, the boss is an old unix programmer, and this whole
thing started because he "heard" somewhere that one can simulate
unix/linux's functionality of CopyMemory to detach a running binary
from the file, update the file, then reattach the binary, effectivly
updating a binary without shutting it down.

So, any pointers?

Thanks,
Jody W
 
H

Herfried K. Wagner [MVP]

Jody L. Whitlock said:
Can someone assist me in this quest? I've been trying in vein for some
time now to figure out how to use AppDomains as a way of making a
plugin architecture. Basically, here's my plan:

1) Load main assembly
2) Create new appdomain to "discover" all plugins and report them back
to the main assembly
3) Destroy discovery domain (To free assemblies/resources)
4) Create new appdomain and load advertised plugins into it

Now, the reason for this is so that if I have a new plugin, I can
destroy the plugin appdomain, start with step 2, and reload the new
plugins without having to reload the main assembly. So, I need to
learn how to do a couple of things:
A) Pass objects between appdomains
B) Call methods in my plugins from my main assembly

AppDomains and Dynamic Loading
<URL:http://msdn.microsoft.com/library/en-us/dncscol/html/csharp05162002.asp>

Plug-in Manager
<URL:http://www.thecodeproject.com/csharp/DynamicPluginManager.asp>

Dynamically executing code in .Net
<URL:http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>
 
J

Jody L. Whitlock

Herfried said:

Wow, definatly not going to be simple to implement. Looks like I'm
also going to have to implement Remoting as well, and also translate
all the sample from C# to VB.NET. Fun, but thanks for the start, it's
more info than I had before.

Thanks,
Jody W
 

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