WCF Custom Serialization

An implementation of a custom serializer for WCF services, using a contract behavior to hook it up on the client and the server.

C# (37.9 KB)
4.8 Star
2,969 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • variation for this service with a separate client
    1 Posts | Last post November 11, 2013
    • Hey Carlos,
      Thanks a lot for writing this example on custom serialization. I feel as though I followed and understood it's implementation, even though WCF programming is still new to me.
      My question is as follows: do you have any advice for implementing a service that communicates with a completely separated client?
      In your example, the proxy channel is able to make use of the attribute due to the fact that it is compiled with the service's code, and therefore makes use of the same contract. When I separated the client into it's own program, and included a service reference to a version of your service that runs on a web server, the serialization was not brought with it. This makes sense, and I'm not confused about it.
      I moved the serialization and data contracts to their own library, and included references in both the service and client projects, so that they may both use them. In the generated code for the client's reference to the service, I added the attribute over the IOrderProcessing interface, and sure enough the serialization worked on the client side.
      Is there a more elegant way to solve this problem? I'm worried that this might not be the best course of action, and perhaps there are WCF technologies that might better serve my purposes.
      Thank you,