473,386 Members | 1,668 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,386 software developers and data experts.

conditional "using"

ARZ
Hi
How do I include DLLs based on a condition. Eg., there are 2 DLLs 'Oracle.dll' and 'SQL.dll'. I need to include ANYONE of the DLLs based on a value. Is it possile in C#
Thanks in advance
ARZ
Nov 15 '05 #1
3 8396

"ARZ" <an*******@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
Hi,
How do I include DLLs based on a condition. Eg., there are 2 DLLs 'Oracle.dll' and 'SQL.dll'. I need to include ANYONE of the DLLs based on a
value. Is it possile in C#? Thanks in advance,
ARZ


You can use conditional compilation, using a "#if SYMBOL / #endif" syntax.
However, there is not much use in conditionally using some "using"
statements,
because these do NOT include anything. A "using" directive just lets you use
a shorter name for your classes.
The real dll-include is done at the project level, with "references".

Hans Kesting
Nov 15 '05 #2
..Net should use these Dll's through COM interoperability by generating a
Runtime Callable Wrapper (RCW) which wraps the Dll COM interfaces with a
..Net front. This is all done for you transparently in Visual Studio - you
simply pull in the appropriate reference using the Add Reference - COM tab
into your project and the rest is done for you.

Add namespace entry

using System.Runtime.Interoperability;

then use the namespace listed in the project references to access and
instantiate the classes you want.

However, I have to question why you wish to access the Oracle.dll and
Sql.dll directly if it is for database access then you probably should be
doing this through the ADO.Net classes.

"ARZ" <an*******@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
Hi,
How do I include DLLs based on a condition. Eg., there are 2 DLLs 'Oracle.dll' and 'SQL.dll'. I need to include ANYONE of the DLLs based on a
value. Is it possile in C#? Thanks in advance,
ARZ

Nov 15 '05 #3
Hi,

IT depends of how/when you decide which one you will use. if you decide it
at compile time then you should use #define #if directives. if you want to
be able to dinamically decide it then you should go for a plug-in
architecture. take a look at jon's article:
http://www.yoda.arachsys.com/csharp/plugin.html it will give you an idea of
how to do it.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"ARZ" <an*******@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
Hi,
How do I include DLLs based on a condition. Eg., there are 2 DLLs 'Oracle.dll' and 'SQL.dll'. I need to include ANYONE of the DLLs based on a
value. Is it possile in C#? Thanks in advance,
ARZ

Nov 15 '05 #4

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

Similar topics

0
by: Justin | last post by:
Hi. I decided to tidy up some of my queries, but I came across something that stumpt me: mysql> SELECT -> jobs.jobId, -> jobs.active, -> jobs.title, -> jobs.listed, -> ...
7
by: Willem van Rumpt | last post by:
Hi all, coming from an unmanaged programming background, I took my time to sort out the IDisposable and finalizer patterns. Just when I thought I had it all conceptually neatly arranged, the...
5
by: charliewest | last post by:
I've implemented the USING statement to ensure that my newly created sql connection closes when my method is finished using it. The USING statement is wrapped in try/catch error handling statement....
14
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects...
15
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it...
25
by: samjnaa | last post by:
Please check for sanity and approve for posting at python-dev. In Visual Basic there is the keyword "with" which allows an object- name to be declared as governing the following statements. For...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.