hi again,
i have several namespacing problems in my big project.
my current namespaces in my solution are:
b2b.Server.Common
b2b.Server.Business
b2b.Server.Business.Mapping
b2b.Server.Business.Entities
b2b.Server.Database
now i have a testing app and i include all of those namespaces in that
app.
Server.Business.Mapping.Facility facility = new
Server.Business.Mapping();
works, but:
Business.Mapping.Facility facility...
or
Mapping.Facility facility...
doesnt work!! of course i have references to those librarys because i
can find them when i begin from Server... but not when i beging from
Business.. why?!
i never had those problems in VB.NET, only in c#..
thanks
Steve. 5 2152
Steven Wolf <ap****@gmx.net> wrote: i have several namespacing problems in my big project.
my current namespaces in my solution are:
b2b.Server.Common b2b.Server.Business b2b.Server.Business.Mapping b2b.Server.Business.Entities b2b.Server.Database
now i have a testing app and i include all of those namespaces in that app.
Server.Business.Mapping.Facility facility = new Server.Business.Mapping();
Hang on - is Mapping a class as well as a namespace, or did you mean to
write new Server.Business.Mapping.Facility()?
works, but:
Business.Mapping.Facility facility...
or
Mapping.Facility facility...
doesnt work!! of course i have references to those librarys because i can find them when i begin from Server... but not when i beging from Business.. why?!
Because namespaces aren't treated in that way in C# - types in the
hierarchy "above" the declaring namespace are automatically included,
but the declaring namespace doesn't become a sort of "root".
Fortunately, with using declarations it shouldn't be a problem - just
declare
using Server.Business.Mapping;
at the top of your class.
i never had those problems in VB.NET, only in c#..
Indeed, C# doesn't treat namespaces in quite the same way as VB.NET.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Hi Jon Hang on - is Mapping a class as well as a namespace, or did you mean to write new Server.Business.Mapping.Facility()?
No, Mapping is a namespace of b2b.Server.Business and Facility is a
class there.
I map there DataTables to my domain objects. Fortunately, with using declarations it shouldn't be a problem - just declare
using Server.Business.Mapping;
at the top of your class.
Well, the problem is, i have also a Facility class in
Server.Business.Entities, so i must use for example
Entities.Facility facility = new Entities.Facility();
Mapping.Facility facilityMapper = new Mapping.Facility();
and so on. but with declaring "using b2b.Server.Business", those both
namespaces (Entities and Mapping) don't appear..
Steve.
Steven Wolf <ap****@gmx.net> wrote: Hang on - is Mapping a class as well as a namespace, or did you mean to write new Server.Business.Mapping.Facility()?
No, Mapping is a namespace of b2b.Server.Business and Facility is a class there.
I map there DataTables to my domain objects.
So you did mean to write new Server.Business.Mapping.Facility, right? Fortunately, with using declarations it shouldn't be a problem - just declare
using Server.Business.Mapping;
at the top of your class.
Well, the problem is, i have also a Facility class in Server.Business.Entities, so i must use for example
Entities.Facility facility = new Entities.Facility(); Mapping.Facility facilityMapper = new Mapping.Facility();
and so on. but with declaring "using b2b.Server.Business", those both namespaces (Entities and Mapping) don't appear..
You could write
using EntitiesFacility = b2b.Server.Business.Entities.Facility;
using MappingFacility = b2b.Server.Business.Mapping.Facility;
and then use "EntitiesFacility" and "MappingFacility" everywhere.
To be honest, I'd just change one set of class names - using the same
classnames in two different namespaces which are both likely to be used
in the same class is just asking for confusion.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
> So you did mean to write new Server.Business.Mapping.Facility, right?
yes, exactly. You could write
using EntitiesFacility = b2b.Server.Business.Entities.Facility; using MappingFacility = b2b.Server.Business.Mapping.Facility;
and then use "EntitiesFacility" and "MappingFacility" everywhere.
wow, i never heard of that possibility, and thats exactly what i need,
thanks! To be honest, I'd just change one set of class names - using the same classnames in two different namespaces which are both likely to be used in the same class is just asking for confusion.
yes, you are right, but i tried to keep the same mapper-class name as
the entity to map. I have also a b2b.Server.Database.Facility class,
it is similar to the datatable and represent a persistence object.
when i create an instance of them, i use faciltiyTable,
facilityEntity, facilityMapper and so on....
but anyway,
thank you for support.
Steven.
Steven Wolf <ap****@gmx.net> wrote: You could write
using EntitiesFacility = b2b.Server.Business.Entities.Facility; using MappingFacility = b2b.Server.Business.Mapping.Facility;
and then use "EntitiesFacility" and "MappingFacility" everywhere.
wow, i never heard of that possibility, and thats exactly what i need, thanks!
Goodo. To be honest, I'd just change one set of class names - using the same classnames in two different namespaces which are both likely to be used in the same class is just asking for confusion.
yes, you are right, but i tried to keep the same mapper-class name as the entity to map. I have also a b2b.Server.Database.Facility class, it is similar to the datatable and represent a persistence object.
when i create an instance of them, i use faciltiyTable, facilityEntity, facilityMapper and so on....
Hmm... I still think you're liable to make things more confusing than
they need to be, but that's your choice - at least now you know how you
can do it!
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marcin Kalicinski |
last post by:
Is the code below ill formed (because operator >> is defined in different
namespace than class B)?
It fails with VS 2005 Beta. I don't know if I should redesign my code or if
I should find a...
|
by: Mike Oliszewski |
last post by:
Given the following c# code:
namespace Company2
{
public class SomeFunctions
{
public void FunctionA()
{
// Do Something.
}
|
by: Kevin Newman |
last post by:
The primary problem I've had with php is the lack of namespaces, which
makes OOP very difficult to organize, since you end up with large number
of classes cluttering up the same namespace - which...
|
by: Pep |
last post by:
Is it best to include the code "using namespace std;" in the source or
should each keyword in the std namespace be qualified by the namespace tag,
such as
std::cout << "using std namespace" <<...
|
by: Armin Zingler |
last post by:
Hi all,
I have a Form called "Main":
Public Class Main
Private Sub Button1_Click( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
| |