Option for adding schema name to CLR namespace?

Mar 9, 2010 at 2:34 PM

I'd like to throw in a suggestion for a new feature when generating data contracts from schemas. I've come across an issue lately that would be solved by this feature. Here's the deal:

Imagine a schema with two imports, let's call them Import1.xsd and Import2.xsd. Import1.xsd declares an element named ReturnElement and Import2.xsd also declares an element named ReturnElement. Import1.xsd and Import2.xsd have different namespaces, thus there is no conflict between the two ReturnElement-elements from an XML perspective.

When generating data contracts, this changes. Whether one choses to output the generated code to a single file or multiple files, one of the two ReturnElement-elements is going to end up with the CLR type Some.Namespace.ReturnElement1.

My suggestion is adding an option for insertion of the schema name into the generated CLR types namespace, going from this:



to this:



Someone have any thoughts on this? Based on a quick browse through the code it looks like a fairly simple feature to implement.