Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Implementing a namespace over more than one assembly?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
thechaosengine - 11 Aug 2005 20:32 GMT
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
Arthur Dent - 11 Aug 2005 21:17 GMT
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.

> Hi all,
>
[quoted text clipped - 19 lines]
>
> tce
Mythran - 11 Aug 2005 22:21 GMT
> Actually you can see this very thing in action in some of MSs own
> assemblies...
[quoted text clipped - 7 lines]
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.