I have a collection containing a LOT of Data Transfer Objects that I need to send to a Silverlight client over WCF. I'm using the default DataContractSerializer and an HTTPS channel.
Here's an example of one type of DTO.
[DataContract(Namespace = Constants.OrgStructureNamespace)]
public class EntityInfo : IExtensibleDataObject
{
[DataMember] public Guid EntityID { get; set; }
[DataMember] public EntityType EntityType { get; set; }
[DataMember] public IList<Guid> EntityVersions { get; set; }
[DataMember] public IList<Guid> OrganisationStructures { get; set; }
#region IExtensibleDataObject Members
...
#endregion
}
The domain entities on the server side use GUIDs as primary keys. These get serialized to strings which are 36 bytes long. A GUID in binary form should only be 16 bytes long.
Is there a trick to get the DataContractSerializer serialize my GUIDs as binary rather than as the verbose strings to increase performance?