473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Passing Data Between Assemblies

I have 2 assemblies (for example). Assembly A references assembly B. If I
have a value in assembly A that I want to be used in assembly B, how can I
store it so that assembly B can access it without actually "passing" the
value to assembly B?

I've seen the Threading.Thread.CurrentThread.SetNamedDataSlot method and was
wondering if that could be "safely" used to store information that would be
passed normally to just about every public method in my class (such as a
connection string).

Reason why I am not storing the Connection String inside the App.config is
it is automatically generated based on user-input. So, I would hate to have
to pass this information into the business logic layer and then into the
data access layer every time I want to access the database. I do not want
to store this information on disk or registry because it may contain
passwords which we do not want stored anywhere else but memory...

Look, I'm babbling! Anywho, thanks for the help y'all :)

Mythran

Nov 17 '05 #1
1 2485
If the assemblies are in the same process (appdomain) then you can could
have a private static variable on a class and this can then be assigned at
runtime and shared between the assemblies via a class property.

If you need more information on static keyword in .Net check out:

http://msdn.microsoft.com/library/de...rfStaticPG.asp
http://msdn.microsoft.com/library/de...eywords_PG.asp
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:uf**************@TK2MSFTNGP10.phx.gbl...
I have 2 assemblies (for example). Assembly A references assembly B. If I have a value in assembly A that I want to be used in assembly B, how can I
store it so that assembly B can access it without actually "passing" the
value to assembly B?

I've seen the Threading.Thread.CurrentThread.SetNamedDataSlot method and was wondering if that could be "safely" used to store information that would be passed normally to just about every public method in my class (such as a
connection string).

Reason why I am not storing the Connection String inside the App.config is
it is automatically generated based on user-input. So, I would hate to have to pass this information into the business logic layer and then into the
data access layer every time I want to access the database. I do not want
to store this information on disk or registry because it may contain
passwords which we do not want stored anywhere else but memory...

Look, I'm babbling! Anywho, thanks for the help y'all :)

Mythran

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Neil Fedin via .NET 247 | last post by:
I am writing a testing application that uses reflection to open assemblies and call methods. I have a function that looks like this... public void Method1 (int IDArray, bool SomethingElse){...
1
by: Treefrog | last post by:
Hi, I have a program that creates some data, this data needs to be parsed but depending on the data created, it'll need to be parsed in a different method. I need the facility to add different...
11
by: Vinod I | last post by:
Hi Team, I am having a string as "System.Data.SqlDbType.Int". Now I want to convert this string type to actual type to use with my Command object Parameter Creation. How I will convert this...
8
by: yo_mismo | last post by:
Hi, I send a parameter from a Form (Form1) to an other form (Form2): Form2 frm2 = new Form2(); frm2.number_frm2 = number_frm1; frm2.Show(); The problem i got is that the variable...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
12
by: scottt | last post by:
hi, I am having a little problem passing in reference of my calling class (in my ..exe)into a DLL. Both programs are C# and what I am trying to do is pass a reference to my one class into a DLL...
7
by: Tim | last post by:
When there is a need to pass some dynamic information between 2 managed assemblies, the "Dictionary object" in Generic form can be used as a method parameter to pass the information. The...
1
by: keliie | last post by:
I have a relatively simple (I assume) issue which I am at a complete loss to address. My issues is: I want to populate fields in my tables with summary data from the same table. Let me explain: ...
0
by: Mythran | last post by:
Problem #1: We have an server application in COM+ on the same machine we have a web application on. The web application creates a Principal and Identity object containing the users information...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.