Groups | Blog | Home
all groups > dotnet xml > october 2007 >

dotnet xml : xmltype and generics


motylik
10/30/2007 4:23:01 PM
I want to expose my classes via web services in a different format. Using
XmlAttributeAttribute and XmlElementAttribute works fine. But XmlType does
not in all cases.

If I have a class decl:

[XmlType("externalFoo")]
public class InternalFoo {}

the schema generated is just fine for public internalFoo. But if I have a
public List<InternalFoo> listoFoo, the type generated in the schema is
ListOfInternalFoo, not ListOfexternalFoo.

This result is aweful for clients, which now must associate mentally that
internalFoo is the same as an externalFoo.

I would speculate the code fails to determine if the member is a generic.
Wouldn't it have been a simple case to check if it's generic, and if so,
check if it has an XmlType attribute (and consequently use that name)?

Course my speculation is often wrong... Any ideas or work arounds? Many
Thanks,
AddThis Social Bookmark Button