msgpack-cli icon indicating copy to clipboard operation
msgpack-cli copied to clipboard

Cannot get GetSerializer for DataSet

Open ndphuong opened this issue 8 years ago • 1 comments

Hi, When I try GetSerializer for DataSet: var serializer = MsgPack.Serialization.SerializationContext.Default.GetSerializer<DataSet>(); It thow exception: An unhandled exception of type 'System.NotSupportedException' occurred in MsgPack.dll Additional information: This operation is not supported because 'System.ComponentModel.ISite' cannot be instanciated.

How can I resolve it ?

ndphuong avatar Mar 10 '17 03:03 ndphuong

Sorry for delay. It is by design, and I think it is best way to implement own serializer for DataSet.

You can do it with implement MessagePackSerializer<DataSet> class and register it through SerializationContext.RegisterSerializer method. It is not easy because DataSet is relatively complex even if it is possible to implement.

As far as I imagine, you have to resolve:

  • You should consider relationships. I think ignoring them is not so bad.
  • You also have to implement serializer for DataTable and DataRow. It looks reasonable that your DataTable will be serialized as DataColumn array and array of each DataRow serialized as msgpack array.

yfakariya avatar Mar 26 '17 13:03 yfakariya