/// <summary>
 /// Serializes the contents of the object into a byte[] and stores in the SerializationInfo block.
 /// </summary>
 /// <param name="obj">The object to serialize.</param>
 /// <param name="info">See .Net serialization.</param>
 /// <param name="context">See .Net serialization.</param>
 public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
 {
     byte[] data;
     if (obj.GetType() == typeof(DataSet) || obj is IModifiedTypedDataSet)
     {
         data = AdoNetHelper.SerializeDataSet(obj as DataSet);
     }
     else if (obj.GetType() == typeof(DataTable))
     {
         data = AdoNetHelper.SerializeDataTable(obj as DataTable);
     }
     else if (obj is DataSet)
     {
         data = AdoNetHelper.SerializeTypedDataSet(obj as DataSet);
     }
     else if (obj is DataTable)
     {
         data = AdoNetHelper.SerializeTypedDataTable(obj as DataTable);
     }
     else
     {
         throw new InvalidOperationException("Not a supported Ado.Net object");
     }
     info.AddValue("_", data);
 }
Ejemplo n.º 2
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     byte[] data = AdoNetHelper.SerializeDataTable(m_dataTable);
     info.AddValue("DataTable_DATA", data);
 }
Ejemplo n.º 3
0
 /// <summary> Method is used to customize the serialization of this object and returns all the
 /// pertinent serialized data, including the main dataset serialized to binary (rather than XML)</summary>
 /// <param name="info"> Serialization information object, to which the data of this class is added </param>
 /// <param name="context"> Context of the serialization request </param>
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue("data", AdoNetHelper.SerializeDataTable(innerData));
 }