Suppose I have a WCF service and a method in the contract
<ServiceContract()> _
Interface IThingService
'...
<OperationContract()> _
Function GetThing(thingId As Guid) As Thing
End Interface
where Thing is an ordinary class with ordinary properties, except for one member:
Public Class Thing
' ...
Public Property Photos() As Dictionary(Of String, Photo)
' ...
End Class
where Photo is an ordinary class with ordinary properties.
So I dove into some documentation such as http://msdn.microsoft.com/en-us/library/aa347850.aspx and http://bit.ly/jA9z3 , and now I am confused if I have to understand a lot about the DataContractSerializer and the particulars of how the service serializes the Photos property.
Do I need to go there, or is there something I can do to let WCF on the server interact with my client automatically? Seems to me all the serialization details should be able to be abstracted away--I just want to end up, in the consuming client app, with:
Dim foo as Thing = ThingServiceClient.GetThing(someGuid)
Dim myPhotos as Dictionary(Of String, Photo) = foo.Photos
What do I need to do in my definition of Thing to make this work? Anything I need to do elsewhere to get this to work? Do I need to worry about ensuring the service sticks to the DataContractSerializer and doesn't fall back to use the XmlSerializer?