How to implement Binary Formatter with Sync Services and WCF? RRS feed

  • Question

  • Hi All,

    Is there any way in which I can use Binary Formatter for serializing the data communication between WCF Service and device client (N-Tier Architecture of Sync Service for ADO.NET v2.0)?

    I have downloaded the binary formatter from CodeProject(http://www.codeproject.com/KB/cs/CF_serializer.aspx).  It seems to be compatible with .NET 1.1/2.0 only
    L.  How can I specify to use this formatter?  Will it help if I am specifying the same as an attribute to the WCF Service Interface in place of [XmlSerializerFormat()]?

    I have tried to use DataSetSurrogate as well since DataSet uses XML Serialization by default.  I have tried converting the DataSet to DataSetSurrogate in ApplyChanges and GetChanges before sending over the wire.  Also, I have modified the proxy class definition as well the signature for these methods.  Since SyncAgent.Synchronize() is calling some private methods (my guess), where I need to do the conversion from DataSetSurrogate to DataSet?  I’m totally confused hereLL.  Is this not possible at all?

    I have referred many articles and I am yet to find out an effective serialization strategy other than XML Serialization; but no luck till nowL.

    Thanks in advance.


    • Moved by Hengzhe Li Friday, April 22, 2011 5:20 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Thursday, March 12, 2009 5:21 PM


  • Hi Praveen,

    I'm streaming data to the ApplyChanges/GetChanges etc methods using a DataContractSerializer together with a Binary writer,  as described here:


    I am syncing a PC client to a WCF service, so I'm not sure if this works in your device scenario.

    Since I'm streaming data, my WCF service looks sort of like this:

    Stream ApplyChanges(Stream in)
    Stream GetChanges(Stream in)

    ... where the streams are just wrappers around a object containg the regular inputs, i.e. SyncContext, DataSet etc. Then you have complete power over how the data is serialized to the Stream

    There is a good thread about streaming on this forum, but the search function seems to have a bad day - I can't find it for my life...



    Saturday, March 21, 2009 9:31 AM