471,337 Members | 1,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Reflection Doubt!

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
Nov 28 '05 #1
4 1422
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]
- mv*@spam.guard.caspershouse.com


TIA

Nov 28 '05 #2
Thanks as always

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ul*************@TK2MSFTNGP15.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com


TIA


Nov 28 '05 #3
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ul*************@TK2MSFTNGP15.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com


TIA


Nov 28 '05 #4
Hi,

Check out my article on Reflection, it might help you answer your
question.

http://www.developersdex.com/gurus/articles/739.asp

Happy Coding,

Stefan
C# GURU
www.DotNETovation.com

"You always have to look beyond the horizon and can never be complacent
-- God forbid we become complacent."

Jozef Straus

*** Sent via Developersdex http://www.developersdex.com ***
Nov 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by forvino | last post: by
2 posts views Thread by forvino | last post: by
11 posts views Thread by Simon Verona | last post: by
reply views Thread by forvino | last post: by
3 posts views Thread by jibesh.vp | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.