/// <summary>
        /// Creates a new instance of the object being deserialized (since no constructors are called)
        /// then deserializes data into it.
        /// </summary>
        /// <param name="obj">The DataSet or DataTable to serialize.</param>
        /// <param name="info">See .Net serialization.</param>
        /// <param name="context">See .Net serialization.</param>
        /// <param name="selector">The selector which selected this surrogate.</param>
        /// <returns></returns>
        public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            obj = createNewInstance(obj);
            byte[] data = (byte[])info.GetValue("_", typeof(byte[]));

            if (obj.GetType() == typeof(DataSet) || obj is IModifiedTypedDataSet)
            {
                return(AdoNetHelper.DeserializeDataSet(obj as DataSet, data));
            }
            else if (obj.GetType() == typeof(DataTable))
            {
                return(AdoNetHelper.DeserializeDataTable(obj as DataTable, data));
            }
            else if (obj is DataSet)
            {
                return(AdoNetHelper.DeserializeTypedDataSet(obj as DataSet, data));
            }
            else if (obj is DataTable)
            {
                return(AdoNetHelper.DeserializeTypedDataTable(obj as DataTable, data));
            }
            else
            {
                throw new InvalidOperationException("Not a supported Ado.Net object");
            }
        }
Exemplo n.º 2
0
 protected FastSerializableDataSet(SerializationInfo info, StreamingContext context)
 {
     AdoNetHelper.DeserializeDataSet(this, (byte[])info.GetValue("_", typeof(byte[])));
 }
Exemplo n.º 3
0
 //Serialization
 public CDataSetFastSerialize(SerializationInfo info, StreamingContext context)
 {
     byte[] data = (byte[])info.GetValue("DATASET_DATA", typeof(byte[]));
     m_dataset = AdoNetHelper.DeserializeDataSet(data);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected RecordSetHelper(SerializationInfo info, StreamingContext context)
 {
     AdoNetHelper.DeserializeDataSet(this, (byte[])info.GetValue("_", typeof(byte[])));
     _opened = info.GetBoolean("Opened");
     _dbType = (DatabaseType)info.GetUInt16("DatabaseType");
 }
Exemplo n.º 5
0
 protected WrappedDataSet(SerializationInfo info, StreamingContext context)
 {
     dataSet = AdoNetHelper.DeserializeDataSet((byte[])info.GetValue("_", typeof(byte[])));
 }
Exemplo n.º 6
0
 ////////////////////////////////////////////////////////////////////////////
 public CMemoryDb(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext contexte)
 {
     AdoNetHelper.DeserializeDataSet(this, (byte[])info.GetValue("DATASET_DATA", typeof(byte[])));
     m_dicPrivateNomTableToType = info.GetValue("DIC_TABLE_TO_TYPE", typeof(Dictionary <string, Type>)) as Dictionary <string, Type>;
     m_dicPrivateTypeToNomTable = info.GetValue("DIC_TYPE_TO_TABLE", typeof(Dictionary <Type, string>)) as Dictionary <Type, string>;
 }