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?

Était-ce utile?

La solution

As detailed here the serializer is trying to enforce uniqueness.

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top