diff options
author | Tim Coleman <tim@mono-cvs.ximian.com> | 2002-05-13 16:27:32 +0400 |
---|---|---|
committer | Tim Coleman <tim@mono-cvs.ximian.com> | 2002-05-13 16:27:32 +0400 |
commit | 5da57864848b7c159b87b27988eee393d182b31b (patch) | |
tree | ba245b441d97120e79dfd7f866048584a9f35bdb /mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs | |
parent | f8263fca0c7deddf4db5a7b1b9e0cd261f193d1a (diff) |
2002-05-13 Tim Coleman
* System.Data.Common/DataTableMappingCollection.cs:
Some implementation to allow progress with DbDataAdapter
svn path=/trunk/mcs/; revision=4586
Diffstat (limited to 'mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs')
-rw-r--r-- | mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs | 115 |
1 files changed, 71 insertions, 44 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs index 0f396f22632..c93e4ccf90e 100644 --- a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs +++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs @@ -3,8 +3,10 @@ // // Author: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc +// Copyright (C) 2002 Tim Coleman // using System; @@ -19,97 +21,122 @@ namespace System.Data.Common MarshalByRefObject, // ITableMappingCollection, IList, IEnumerable //ICollection, { - [MonoTODO] - public DataTableMappingCollection() { - throw new NotImplementedException (); + private ArrayList mappingList; + private ArrayList sourceTableList; + private ArrayList dataSetTableList; + + public DataTableMappingCollection() + { + sourceTableList = new ArrayList (); + dataSetTableList = new ArrayList (); + mappingList = new ArrayList (); } - [MonoTODO] - public int Add (object obj) { - throw new NotImplementedException (); + public int Add (object value) + { + if (!(value is System.Data.Common.DataTableMapping)) + throw new SystemException ("The object passed in was not a DataTableMapping object."); + + string sourceTable = ((DataTableMapping)value).SourceTable; + string dataSetTable = ((DataTableMapping)value).DataSetTable; + mappingList.Add (value); + dataSetTableList.Add (dataSetTable); + return sourceTableList.Add (sourceTable); } - [MonoTODO] - public DataTableMapping Add (string a, string b) { - throw new NotImplementedException (); + public DataTableMapping Add (string sourceTable, string dataSetTable) + { + DataTableMapping dataTableMapping = new DataTableMapping (sourceTable, dataSetTable); + + mappingList.Add (dataTableMapping); + sourceTableList.Add (sourceTable); + dataSetTableList.Add (dataSetTable); + + return dataTableMapping ; } - [MonoTODO] - public void AddRange(DataTableMapping[] values) { - throw new NotImplementedException (); + public void AddRange(DataTableMapping[] values) + { + foreach (DataTableMapping dataTableMapping in values) + this.Add (dataTableMapping); } - [MonoTODO] - public void Clear() { - throw new NotImplementedException (); + public void Clear() + { + sourceTableList.Clear (); + dataSetTableList.Clear (); + mappingList.Clear (); } - [MonoTODO] - public bool Contains (object obj) { - throw new NotImplementedException (); + public bool Contains (object value) + { + return mappingList.Contains (value); } - [MonoTODO] - public bool Contains (string str) { - throw new NotImplementedException (); + public bool Contains (string value) + { + return sourceTableList.Contains (value); } [MonoTODO] - public void CopyTo(Array array, int index) { + public void CopyTo(Array array, int index) + { throw new NotImplementedException (); } - [MonoTODO] - public DataTableMapping GetByDataSetTable(string dataSetTable) { - throw new NotImplementedException (); + public DataTableMapping GetByDataSetTable (string dataSetTable) + { + return (DataTableMapping)mappingList[dataSetTableList.IndexOf(dataSetTable)]; } [MonoTODO] - public static DataTableMapping GetTableMappingBySchemaAction( - DataTableMappingCollection tableMappings, - string sourceTable, - string dataSetTable, - MissingMappingAction mappingAction) { + public static DataTableMapping GetTableMappingBySchemaAction (DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction) + { throw new NotImplementedException (); } - [MonoTODO] - public int IndexOf (object obj) { - throw new NotImplementedException (); + public int IndexOf (object value) + { + return mappingList.IndexOf (value); } - [MonoTODO] - public int IndexOf (string str) { - throw new NotImplementedException (); + public int IndexOf (string value) + { + return sourceTableList.IndexOf (value); } - [MonoTODO] - public int IndexOfDataSetTable (string dataSetTable) { - throw new NotImplementedException (); + public int IndexOfDataSetTable (string dataSetTable) + { + return dataSetTableList.IndexOf (dataSetTable); } [MonoTODO] - public void Insert (int index, object value) { + public void Insert (int index, object value) + { throw new NotImplementedException (); } [MonoTODO] - public void Remove (object value) { + public void Remove (object value) + { throw new NotImplementedException (); } [MonoTODO] - public void RemoveAt (int index) { + public void RemoveAt (int index) + { throw new NotImplementedException (); } [MonoTODO] - public void RemoveAt (string index) { + public void RemoveAt (string index) + { throw new NotImplementedException (); } [MonoTODO] - public int Count { + public int Count + { get { throw new NotImplementedException (); } } |