ApplicationDomains

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jody L. Whitlock

    #1

    ApplicationDomains

    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
  • Carlos J. Quintero [.NET MVP]

    #2
    Re: ApplicationDoma ins

    There are 3 links about that subject at the bottom of this page of my web
    site:

    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


    --
    Best regards,

    Carlos J. Quintero

    MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
    You can code, design and document much faster.
    Free resources for add-in developers:
    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


    "Jody L. Whitlock" <tierscheiss197 7@hotmail.com> escribió en el mensaje
    news:e5pENjTfFH A.1148@TK2MSFTN GP12.phx.gbl...[color=blue]
    > 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[/color]


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: ApplicationDoma ins

      "Jody L. Whitlock" <tierscheiss197 7@hotmail.com> schrieb:[color=blue]
      > 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[/color]

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

      Plug-in Manager
      <URL:http://www.thecodeproj ect.com/csharp/DynamicPluginMa nager.asp>

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

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Jody L. Whitlock

        #4
        Re: ApplicationDoma ins

        Herfried K. Wagner [MVP] wrote:
        [color=blue]
        > "Jody L. Whitlock" <tierscheiss197 7@hotmail.com> schrieb:[color=green]
        > > 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[/color]
        >
        > AppDomains and Dynamic Loading
        > <url:
        > http://msdn.microsoft.com/library/en...arp05162002.as
        > p>
        >
        > Plug-in Manager
        > <url: http://www.thecodeproj ect.com/csharp/DynamicPluginMa nager.asp>
        >
        > Dynamically executing code in .Net
        > <url:
        > http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm >[/color]

        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

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: ApplicationDoma ins

          "Jody L. Whitlock" <tierscheiss197 7@hotmail.com> schrieb:[color=blue][color=green]
          >> AppDomains and Dynamic Loading
          >> <url:
          >> http://msdn.microsoft.com/library/en...arp05162002.as
          >> p>
          >>
          >> Plug-in Manager
          >> <url: http://www.thecodeproj ect.com/csharp/DynamicPluginMa nager.asp>
          >>
          >> Dynamically executing code in .Net
          >> <url:
          >> http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm >[/color]
          >
          > 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.[/color]

          An implementation of loading and unloading application domains can be found
          here:

          <URL:http://dotnet.mvps.org/dotnet/articles/sharedfinalizer/SharedFinalizer .zip>

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://classicvb.org/petition/>

          Comment

          Working...