Dynamic Assembly Loading Strategy

Discussion in 'ASP .Net' started by =?Utf-8?B?QnJpYW5T?=, Jan 11, 2005.

  1. What is the best strategy for dynamic loading private assemblies in asp.net?
    I understand, and have confirmed, that any dll placed in the app's /bin dir
    will get loaded on startup. This is not desirable.

    I have a web service that, based on an input parameter, dynamically loads A,
    B or C library. I also understand that an separate AppDomain is needed to
    explicitly unload the Assembly. No other apps will use these assemblies.

    Do I need an IPlugin Interface type architecture to correctly achieve this?

    Where should I put the "sub" assemblies?

    Do I use Load, LoadFrom or LoadFile?

    Regards,
    Brian
     
    =?Utf-8?B?QnJpYW5T?=, Jan 11, 2005
    #1
    1. Advertising

  2. Your first statement is not true. Assemblies are loaded the first time a
    type is loaded from the assembly.

    HTH,

    bill


    "BrianS" <> wrote in message
    news:...
    > What is the best strategy for dynamic loading private assemblies in

    asp.net?
    > I understand, and have confirmed, that any dll placed in the app's /bin

    dir
    > will get loaded on startup. This is not desirable.
    >
    > I have a web service that, based on an input parameter, dynamically loads

    A,
    > B or C library. I also understand that an separate AppDomain is needed to
    > explicitly unload the Assembly. No other apps will use these assemblies.
    >
    > Do I need an IPlugin Interface type architecture to correctly achieve

    this?
    >
    > Where should I put the "sub" assemblies?
    >
    > Do I use Load, LoadFrom or LoadFile?
    >
    > Regards,
    > Brian
     
    William F. Robertson, Jr., Jan 11, 2005
    #2
    1. Advertising

  3. This is true for Windows forms, but not Asp.Net.

    Throw any dll in yopur apps /bin dir, then on startup query the assembly
    with reflection on startup:

    Dim myAssemblies() As [Assembly] = AppDomain.CurrentDomain.GetAssemblies

    asp.net always loads assemblies because of machine.config setting <add
    assembly="*" />



    "William F. Robertson, Jr." wrote:

    > Your first statement is not true. Assemblies are loaded the first time a
    > type is loaded from the assembly.
    >
    > HTH,
    >
    > bill
    >
    >
    > "BrianS" <> wrote in message
    > news:...
    > > What is the best strategy for dynamic loading private assemblies in

    > asp.net?
    > > I understand, and have confirmed, that any dll placed in the app's /bin

    > dir
    > > will get loaded on startup. This is not desirable.
    > >
    > > I have a web service that, based on an input parameter, dynamically loads

    > A,
    > > B or C library. I also understand that an separate AppDomain is needed to
    > > explicitly unload the Assembly. No other apps will use these assemblies.
    > >
    > > Do I need an IPlugin Interface type architecture to correctly achieve

    > this?
    > >
    > > Where should I put the "sub" assemblies?
    > >
    > > Do I use Load, LoadFrom or LoadFile?
    > >
    > > Regards,
    > > Brian

    >
    >
    >
     
    =?Utf-8?B?QnJpYW5T?=, Jan 11, 2005
    #3
  4. I was not aware of that. Thanks for the info.

    When I have needed to create an instance of a type in a difference assembly,
    I have used LoadFile.

    System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(
    assemblyPath );

    HTH,

    bill

    "BrianS" <> wrote in message
    news:...
    > This is true for Windows forms, but not Asp.Net.
    >
    > Throw any dll in yopur apps /bin dir, then on startup query the assembly
    > with reflection on startup:
    >
    > Dim myAssemblies() As [Assembly] = AppDomain.CurrentDomain.GetAssemblies
    >
    > asp.net always loads assemblies because of machine.config setting <add
    > assembly="*" />
    >
    >
    >
    > "William F. Robertson, Jr." wrote:
    >
    > > Your first statement is not true. Assemblies are loaded the first time

    a
    > > type is loaded from the assembly.
    > >
    > > HTH,
    > >
    > > bill
    > >
    > >
    > > "BrianS" <> wrote in message
    > > news:...
    > > > What is the best strategy for dynamic loading private assemblies in

    > > asp.net?
    > > > I understand, and have confirmed, that any dll placed in the app's

    /bin
    > > dir
    > > > will get loaded on startup. This is not desirable.
    > > >
    > > > I have a web service that, based on an input parameter, dynamically

    loads
    > > A,
    > > > B or C library. I also understand that an separate AppDomain is needed

    to
    > > > explicitly unload the Assembly. No other apps will use these

    assemblies.
    > > >
    > > > Do I need an IPlugin Interface type architecture to correctly achieve

    > > this?
    > > >
    > > > Where should I put the "sub" assemblies?
    > > >
    > > > Do I use Load, LoadFrom or LoadFile?
    > > >
    > > > Regards,
    > > > Brian

    > >
    > >
    > >
     
    William F. Robertson, Jr., Jan 12, 2005
    #4
  5. If I were you, I'd use a different name
    for the Reflection.Assembly instance.

    :)



    Juan T. Llibre
    ASP.NET MVP
    ===========
    "William F. Robertson, Jr." <> wrote in message
    news:O0avx5L%...
    >I was not aware of that. Thanks for the info.
    >
    > When I have needed to create an instance of a type in a difference
    > assembly,
    > I have used LoadFile.
    >
    > System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(
    > assemblyPath );
    >
    > HTH,
    >
    > bill
    >
    > "BrianS" <> wrote in message
    > news:...
    >> This is true for Windows forms, but not Asp.Net.
    >>
    >> Throw any dll in yopur apps /bin dir, then on startup query the assembly
    >> with reflection on startup:
    >>
    >> Dim myAssemblies() As [Assembly] = AppDomain.CurrentDomain.GetAssemblies
    >>
    >> asp.net always loads assemblies because of machine.config setting <add
    >> assembly="*" />
    >>
    >>
    >>
    >> "William F. Robertson, Jr." wrote:
    >>
    >> > Your first statement is not true. Assemblies are loaded the first time

    > a
    >> > type is loaded from the assembly.
    >> >
    >> > HTH,
    >> >
    >> > bill
    >> >
    >> >
    >> > "BrianS" <> wrote in message
    >> > news:...
    >> > > What is the best strategy for dynamic loading private assemblies in
    >> > asp.net?
    >> > > I understand, and have confirmed, that any dll placed in the app's

    > /bin
    >> > dir
    >> > > will get loaded on startup. This is not desirable.
    >> > >
    >> > > I have a web service that, based on an input parameter, dynamically

    > loads
    >> > A,
    >> > > B or C library. I also understand that an separate AppDomain is
    >> > > needed

    > to
    >> > > explicitly unload the Assembly. No other apps will use these

    > assemblies.
    >> > >
    >> > > Do I need an IPlugin Interface type architecture to correctly achieve
    >> > this?
    >> > >
    >> > > Where should I put the "sub" assemblies?
    >> > >
    >> > > Do I use Load, LoadFrom or LoadFile?
    >> > >
    >> > > Regards,
    >> > > Brian
    >> >
    >> >
    >> >

    >
    >
     
    Juan T. Llibre, Jan 12, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prasanna Padmanabhan
    Replies:
    1
    Views:
    819
    Mattias Sjögren
    Nov 19, 2003
  2. Brent
    Replies:
    1
    Views:
    1,364
    Brent
    Jan 23, 2004
  3. Barry Kelly
    Replies:
    4
    Views:
    4,715
    Barry Kelly
    Dec 7, 2004
  4. glitteringsounds
    Replies:
    1
    Views:
    1,340
    Alf P. Steinbach /Usenet
    Jul 3, 2010
  5. Chris
    Replies:
    1
    Views:
    102
    Tasos Vogiatzoglou
    Sep 24, 2005
Loading...

Share This Page