Dynamic Assembly Loading Strategy

G

Guest

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
 
W

William F. Robertson, Jr.

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

HTH,

bill
 
G

Guest

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="*" />
 
W

William F. Robertson, Jr.

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 said:
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 said:
Your first statement is not true. Assemblies are loaded the first time a
type is loaded from the assembly.

HTH,

bill


/bin
dir loads
A,
 
J

Juan T. Llibre

If I were you, I'd use a different name
for the Reflection.Assembly instance.

:)



Juan T. Llibre
ASP.NET MVP
===========
William F. Robertson said:
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 said:
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 said:
Your first statement is not true. Assemblies are loaded the first time a
type is loaded from the assembly.

HTH,

bill


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
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top