Beispiel #1
0
        public virtual void SetState(DataSet state)
        {
            if (state.GetType() != typeof(InternalDataSet))
            {
                throw new ArgumentException("Internal state must be of type InternalDataSet.", "state");
            }
            //Clear previous state handlers
            _sourcedataset.MergeFailed -= new MergeFailedEventHandler(WrapMergeFailed);
            _sourcedataset.DataSetGetSchemaSerializable    -= new GetSchemaSerializableEventHandler(OnGetSchemaSerializable);
            _sourcedataset.DataSetReadXmlSerializable      -= new ReadXmlSerializableEventHandler(OnReadXmlSerializable);
            _sourcedataset.DataSetShouldSerializeRelations -= new BooleanEventHandler(OnShouldSerializeRelations);
            _sourcedataset.DataSetShouldSerializeTables    -= new BooleanEventHandler(OnShouldSerializeTables);
            _sourcedataset.DataSetOnRemoveRelation         -= new OnRemoveRelationEventHandler(OnOnRemoveRelation);
            _sourcedataset.DataSetOnRemoveTable            -= new OnRemoveTableEventHandler(OnOnRemoveTable);

            //Attach handlers to the new state
            _sourcedataset              = (InternalDataSet)state;
            _sourcedataset.MergeFailed += new MergeFailedEventHandler(WrapMergeFailed);
            _sourcedataset.DataSetGetSchemaSerializable    += new GetSchemaSerializableEventHandler(OnGetSchemaSerializable);
            _sourcedataset.DataSetReadXmlSerializable      += new ReadXmlSerializableEventHandler(OnReadXmlSerializable);
            _sourcedataset.DataSetShouldSerializeRelations += new BooleanEventHandler(OnShouldSerializeRelations);
            _sourcedataset.DataSetShouldSerializeTables    += new BooleanEventHandler(OnShouldSerializeTables);
            _sourcedataset.DataSetOnRemoveRelation         += new OnRemoveRelationEventHandler(OnOnRemoveRelation);
            _sourcedataset.DataSetOnRemoveTable            += new OnRemoveTableEventHandler(OnOnRemoveTable);
        }
Beispiel #2
0
 internal DataSetWrapper(string schemaFile)
 {
     _sourcedataset = new InternalDataSet();
     SetSchema(schemaFile);
 }
Beispiel #3
0
 internal DataSetWrapper(string schemaFile, InternalDataSet datasetData)
 {
     _sourcedataset = datasetData;
     SetSchema(schemaFile);
 }