Serialization attributes for request types RRS feed

  • Question

  • Hi,

    In the samples I see that we put [DataContract] and [DataMember] attributes for Request types and their properties. These attributes function clearly for the state types and we can see the serialized results for the state but why do we use these also for the request types? For example see ServiceTutorial7. And now that we use them on request types, why don't we use them on Message types as well?



    Friday, May 11, 2007 7:18 PM


  • The reason is that request types are serialized over the proxies to be delivered from a partner service to another service, even though they are not seen in the browser. We use DataContract/DataMember for everything that shows up in the body of DsspOperations, found in ports: every class, data struct that needs to be cloned, serialized. But not the container operation type, since that is the “envelope”. Things that go in the body is what needs these attributes. Also things that go in the Headers field of DsspOperation.


    Also note that serializable properties that are decorated with [DataMember] attribute also need to be {get; set;} to be serialized correctly.



    Wednesday, May 16, 2007 8:34 PM