473,395 Members | 1,411 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.

Implementing a namespace over more than one assembly?

Hi all,

Can anyone tell me if it is advisable (or even possible) to define a namespace
across 2 or more assemblies?

For example, consider the namespace SampleApplication.Data.Providers

Would it be possible to have assembly A define a class as part of that namespace
as well as Assembly B also declaring a class to be within it as well?

In particular, I have a number of data providers. It would be useful (I think)
to declare them in the same namespace, but for the purposes of a demonstration
I'm doing, each provider must exisit in its own seperately deployed assembly.

Is this possible and is it a good idea?

Thanks to anyone who can share some advice! :-)

Kindest Regards

tce
Nov 22 '05 #1
4 1981
Actually you can see this very thing in action in some of MSs own
assemblies...

System.Data namespace which is (i believe) defined in mscorlib.dll.
System.Data.OracleClient which is defined in the
System.Data.OracleClient.dll

I dont know how name resolution would work though if you had two classes
named the same
from two different assemblies in the same namespace both in reference in one
project.

I did something VERY similar to your project... what i did, is i made myself
one root assembly which
had my base classes defined, from which the individual providers all
inherited (significant shared code).

I put that in dll My.Data.dll (for example)
Then i put the base classes in their in the namespace My.Data.Definitions

Then each provider can be written in its own assembly such as :

My.Data.Oracle.dll where NS = My.Data.Oracle
My.Data.SqlServer.dll where NS = My.Data.SqlServer
My.Data.ODBC.dll where NS = My.Data.ODBC and so on.

Then you ref in your project the base dll My.Data.dll, and the appropriate
one for whichever provider you need.

HTH.
"thechaosengine" <na> wrote in message
news:43*********************@news.microsoft.com...
Hi all,

Can anyone tell me if it is advisable (or even possible) to define a
namespace across 2 or more assemblies?

For example, consider the namespace SampleApplication.Data.Providers

Would it be possible to have assembly A define a class as part of that
namespace as well as Assembly B also declaring a class to be within it as
well?

In particular, I have a number of data providers. It would be useful (I
think) to declare them in the same namespace, but for the purposes of a
demonstration I'm doing, each provider must exisit in its own seperately
deployed assembly.

Is this possible and is it a good idea?

Thanks to anyone who can share some advice! :-)

Kindest Regards

tce

Nov 22 '05 #2

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
Actually you can see this very thing in action in some of MSs own
assemblies...

System.Data namespace which is (i believe) defined in mscorlib.dll.
System.Data.OracleClient which is defined in the
System.Data.OracleClient.dll

I dont know how name resolution would work though if you had two classes
named the same
from two different assemblies in the same namespace both in reference in
one


To add additional assemblies that do this:

mscorlib.dll - Defines most of the System root namespace's classes.
System.dll - Defines only a few of the System root namespace's classes.

HTH :)

Mythran

Nov 22 '05 #3
Gentlemen, thank you kindly for your advice. You have both been a great help.

Thanks again

Kindest Regards

tce
"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
Actually you can see this very thing in action in some of MSs own
assemblies...

System.Data namespace which is (i believe) defined in mscorlib.dll.
System.Data.OracleClient which is defined in the
System.Data.OracleClient.dll

I dont know how name resolution would work though if you had two
classes
named the same
from two different assemblies in the same namespace both in reference
in
one

To add additional assemblies that do this:

mscorlib.dll - Defines most of the System root namespace's classes.
System.dll - Defines only a few of the System root namespace's
classes.

HTH :)

Mythran

Nov 22 '05 #4
Gentlemen, thank you kindly for your advice. You have both been a great help.

Thanks again

Kindest Regards

tce
"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
Actually you can see this very thing in action in some of MSs own
assemblies...

System.Data namespace which is (i believe) defined in mscorlib.dll.
System.Data.OracleClient which is defined in the
System.Data.OracleClient.dll

I dont know how name resolution would work though if you had two
classes
named the same
from two different assemblies in the same namespace both in reference
in
one

To add additional assemblies that do this:

mscorlib.dll - Defines most of the System root namespace's classes.
System.dll - Defines only a few of the System root namespace's
classes.

HTH :)

Mythran

Nov 22 '05 #5

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

Similar topics

2
by: Paul | last post by:
Have a problem/Question - I have created a C# class that inherits from MarshalByRefObject as well as implements a custom Interface that I have created. The thing that is not working is that when...
5
by: Paul | last post by:
OK...I must be missing something...can someone tell me what I'm not doing properly... First, create an assembly with a single interface in VB.NET as follow Public Interface IDo Function...
3
by: thechaosengine | last post by:
Hi all, Can anyone tell me if it is advisable (or even possible) to define a namespace across 2 or more assemblies? For example, consider the namespace SampleApplication.Data.Providers ...
2
by: Robb Sadler | last post by:
I am trying to write several hardware interfaces that would use the same base class and functions and be implemented differently. I don't want to ship all of the interfaces, but want to access...
1
by: Phill. W | last post by:
Having changed a VB.Net(2003) DLL project, I'm getting Type Loading problems in other code that uses my DLL. In my source code, I have a Namespace Statement something like this: Namespace...
29
by: Tiraman | last post by:
Hi, I Build my own dll with my own namespace name and i would like to put it in one place but for the project bin folder so all of the projects will be able to use it . i tried to put the dll...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
1
by: Dan Holmes | last post by:
I can't find where i have declared ICategoryService as being in the IVS.WMS.Product namespace. I have recompiled. Deleted the obj and bin dirs. Removed the reference. I can't figure out how the...
0
by: ssnsridhar | last post by:
Hi, I ve saw a sample instance provider and have done a service which wil just display wat i have entered in ma service code.. Now i want to Enumerate, Create, Get, Modify operations. Can anyone...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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.