473,799 Members | 3,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1486
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.co m


TIA

Nov 28 '05 #2
Thanks as always

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:ul******** *****@TK2MSFTNG P15.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.co m


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.c om> wrote in
message news:ul******** *****@TK2MSFTNG P15.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.co m


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1484
by: forvino | last post by:
Hi Geeks, Ihave a doubt in dotNet reflection. I m developing a tool which will returns set of public(access specifier) methods of the selected assembly. this works completely fine, when the selected components are
1
24196
by: Mudassar | last post by:
i want to get the property value using reflection. Scenerio: i have a status bar on MDI form. it has property named "Panels" and i want to get a specific panel from that panels collection using reflection. Please let me know. Thanks C# Developer
2
1414
by: forvino | last post by:
Hi Geeks, Ihave a doubt in dotNet reflection. I m developing a tool which will returns set of public(access specifier) methods of the selected assembly. this works completely fine, when the selected components are
2
2016
by: Mark | last post by:
Am I out of my mind if I use Reflection everytime someone logs into our site to get and track the current Major/Minor/Build/Revision version that the person is viewing our site through? This information would then be logged to a database along with some other information about the user. Thanks in advance. Mark
11
1404
by: Simon Verona | last post by:
How can I write a line of code that sets an object to be an object thats contained on the parent form. Basically, I have a usercontrol, where one of the properties that I have added that can be entered at design time is an object name (on a windows form). I want to be able to set a variable to that object within the control so I can then manipulate it.
0
881
by: forvino | last post by:
Hi Geeks, Ihave a doubt in dotNet reflection. I m developing a tool which will returns set of public(access specifier) methods of the selected assembly. this works completely fine, when the selected components are
3
2320
by: jibesh.vp | last post by:
Hi all, I have a doubt in using C# Reflection mechanism . What i need is to get method info alone from a class type. Following code gets all the Properties inside the class too and there is no way to differentiate a method from property.
15
2159
by: Jeff Mason | last post by:
Hi, I'm having a reflection brain fog here, perhaps someone can set me on the right track. I'd like to define a custom attribute to be used in a class hierarchy. What I want to do is to have an attribute which can be applied to a class definition of a class which inherits from a base, mustinherit class. I want to define methods in the base class which will access the contents of the attribute as it is applied to
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.