Question

I'm using ASP.NET Web API to serve out the following class

public class MyListDataContract<T> : List<MyObjectDataContract<T>> where T : MyDataContract

I'm using DataContractAttribute on this specific T and DataMemberAttribute on the instance of this property.

The XML representation of this becomes

<MyObjectDataContractRvPTQ4uA>
...
</MyObjectDataContractRvPTQ4uA>
<MyObjectDataContractRvPTQ4uA>
....
</MyObjectDataContractRvPTQ4uA>
.
.

I have no idea what would be causing this, maybe a naming conflict?

Was it helpful?

Solution

As detailed here the serializer is trying to enforce uniqueness.

Forcing the DataContractAttribute Name to be MyObjectDataContract{0} works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top