Reflection Doubt!

V

Vai2000

Hi All, I am using Reflection for invoking an assembly.I use the
LoadFrom(string) Method, have few doubts, will appreciate all your answers.

1. Should the assembly resides in GAC or at my custom location? (Please tell
me pros/cons)
2. If multiple calls are made to the target assembly by a Multithreaded
app..it should be fine? (tips to keep in mind)

TIA
 
N

Nicholas Paldino [.NET/C# MVP]

Vai2000,

See inline:
1. Should the assembly resides in GAC or at my custom location? (Please
tell
me pros/cons)

When you use LoadFrom, you will not be loading the assembly from the
GAC. It will either be in the location specified by the path passed to
LoadFrom, or it will not. If you want to check the GAC, then you will want
to use the Load method on the Assembly class to load it (assuming that
fusion will find it in the gac).

Another thing. As of version 2.0, I believe .NET grants full trust to
everything that is placed in the GAC (being that an administrator has to
install it there). If you are creating a plug-in architecture, then I don't
know that you want to require that it is installed in the GAC.
2. If multiple calls are made to the target assembly by a Multithreaded
app..it should be fine? (tips to keep in mind)

No, it will not be. Every type in the assembly has to be coded to
handle calls from multiple threads.

Hope this helps.
 
V

Vai2000

Thanks as always

Nicholas Paldino said:
Vai2000,

See inline:
1. Should the assembly resides in GAC or at my custom location? (Please
tell
me pros/cons)

When you use LoadFrom, you will not be loading the assembly from the
GAC. It will either be in the location specified by the path passed to
LoadFrom, or it will not. If you want to check the GAC, then you will want
to use the Load method on the Assembly class to load it (assuming that
fusion will find it in the gac).

Another thing. As of version 2.0, I believe .NET grants full trust to
everything that is placed in the GAC (being that an administrator has to
install it there). If you are creating a plug-in architecture, then I don't
know that you want to require that it is installed in the GAC.
2. If multiple calls are made to the target assembly by a Multithreaded
app..it should be fine? (tips to keep in mind)

No, it will not be. Every type in the assembly has to be coded to
handle calls from multiple threads.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)



 
P

Peter Rilling

Let me expand on the second point. Once an assembly is loaded, all the
classes and such are handled the same as types that were loaded when your
app started. That means that if you have classes that do not maintain
state, then you should be fine (thread safe), otherwise you would need to
ensure your stuff are synchronized.

Nicholas Paldino said:
Vai2000,

See inline:
1. Should the assembly resides in GAC or at my custom location? (Please
tell
me pros/cons)

When you use LoadFrom, you will not be loading the assembly from the
GAC. It will either be in the location specified by the path passed to
LoadFrom, or it will not. If you want to check the GAC, then you will
want to use the Load method on the Assembly class to load it (assuming
that fusion will find it in the gac).

Another thing. As of version 2.0, I believe .NET grants full trust to
everything that is placed in the GAC (being that an administrator has to
install it there). If you are creating a plug-in architecture, then I
don't know that you want to require that it is installed in the GAC.
2. If multiple calls are made to the target assembly by a Multithreaded
app..it should be fine? (tips to keep in mind)

No, it will not be. Every type in the assembly has to be coded to
handle calls from multiple threads.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)



 

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