Question

I am trying to pass some Subsonic collections to a client via a web service. When I reference the web service the IDE complains with:

Cannot serialize member 'EndDate' of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.

Is there any way of serializing nullable complex types in a .net web service?

Was it helpful?

Solution

The way you handle optional properties is to include a boolean XXXSpecified member where XXX is the name of the property. Nullable types are not handled properly by the xml serializer used by ASMX. Note that this is not a limitation of WCF.

OTHER TIPS

This is a .NET Limitation

If you want you can try generating your classes with this property in the SubSonicService section in the the web.config file.

generateNullableProperties="false"

http://forums.subsonicproject.com/forums/t/3285.aspx

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