Is this OK:
namespace Simple.OData
{
// Common OData functionality
}
namespace Simple.Data.OData
{
// The Simple.Data adapter for OData
}
It feels like it might be wrong, but I'm not sure.
Inside a namespace, no two classes can have the same name.
Names are what can be traditionally thought of as "variables". Namespaces are the places where names live.
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
There is no need to have a namespace. However developer studio expects you to be using a name space. For example, when you choose to add a class to a project developer studio will: Create a file for the class.
It's certainly valid - consider System.Xml.Linq
and System.Linq
. I can't immediately foresee any problems... but that's not to say it's necessarily a good idea.
Personally I prefer Simple.Data.OData
over Simple.OData.Data
, as I suspect this is primarily aimed at people who are using Simple.Data
, but happen to be using OData - not people who are focused on OData
. Again, this is like LINQ: System.Xml.Linq
is an XML API which plays will with LINQ; it's not a LINQ "provider" as such.
Basically it's the same sort of problem as "I have a converter to convert from type A to type B; do I put it near type A or type B?" - but with namespaces. My experience is that usually more head-scratching goes into thinking of the best thing to do than the problems that would be caused by taking either approach...
More correct would be, namespace Simple.OData.Data
.
This is because the Data
namespace should be grouped with the other classes relating to OData
.
If you're thinking along with lines of System.Data
, System.Data.SqlClient
then it's pretty much because they are a part of the System.Data.dll
assembly, and are an integrated part of it. My own implementation of the IDbCommand
etc classes live in MyNamespace.SubNamespace.AdoWrapper
namespace, if that gives you some context.
In your case, Simple.Data
presumably doesn't exist or have much in it, unlike System.Data
..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With