DataContractSerializer: Working with class inheritence and circular references

DataContractSerializer is the default serializer used by WCF Services. Typically, we transmit data objects generated via Entity Framework or LINQ To SQL and do not get any serialization issues as the generated classes are ready to handle various serialization scenarios. Some days back, I needed to transmit my own business objects on the wire; encountered a few issues and learned how to handle them. This post will highlight two such issues that may happen when we transmit our own classes via WCF service.

  1. Dealing with inheritance hierarchies
  2. Dealing with circular references

Read the rest of this entry »

Advertisements

WCF Service: Getting to the cause of error

If you are using WCF service as your mode of communication between client-server applications (and why shouldn’t you, this has been a great source of communication available since .NET 3.5), then there are chances that something wrong happened and you get a generic Communication Exception at your client. This post will highlight how to find the cause of such error.
Read the rest of this entry »