"steve" <st***@discussions.microsoft.com> wrote in message news:FA**********************************@microsof t.com...
Can someone point me to some information on namespace best practices?
: : 1) Should I use .NET namespaces or URL, URI and URN's? Ie
mycompany.mydivision.myapp vs http://www.mycompany.com/division/app?
You should use CLR (Common Language Runtime) namespaces like
MyCompany.MyApp in your CLS (Common Language Spec) or .NET
programming language source files. You should use URI's for XML
namespaces (URL, URN, take your pick, it's not like the location you
get by dereferencing a URL needs to exist). If you interchange these
you will get errors.
While your URL doesn't need to physically exist, make sure you own
the domain name in it, otherwise somebody else will buy it for $5. If
you don't own a URL, or it's only for demonstration purposes, then
you can use a demo URL like www.example.com or www.tempuri.org
which have been scarfed up as a community service for that purpose.
: : 2) Should I use namespace prefixes? I thought I read something using
prefixes is a bad idea?
Yes, use namespace prefixes. It's the only way to refer to entities from
two different namespaces simultaneously. You'll need to do this a lot
when working with SOAP and WS-*, there's no avoiding it.
However, don't think your namespace prefixes are special. It's not the
namespace prefix that matters, it is the namespace URI behind it. If
you have two prefixes that are different (ns1 and ns2), but you declare
them w/ the same, identical namespace URI (
http://www.example.com),
then ns1:elem and ns2:elem have the same qualified name (QName,
think of it as
http://www.example.com:elem for both of them).
Derek Harmon