DataTableMappingCollection.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // System.Data.Common.DataTableMappingCollection.cs
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Tim Coleman ([email protected])
  7. //
  8. // (C) Ximian, Inc
  9. // Copyright (C) 2002 Tim Coleman
  10. //
  11. using System;
  12. using System.Collections;
  13. namespace System.Data.Common
  14. {
  15. /// <summary>
  16. /// A collection of DataTableMapping objects. This class cannot be inherited.
  17. /// </summary>
  18. public sealed class DataTableMappingCollection :
  19. MarshalByRefObject, // ITableMappingCollection, IList,
  20. IEnumerable //ICollection,
  21. {
  22. private ArrayList mappingList;
  23. private ArrayList sourceTableList;
  24. private ArrayList dataSetTableList;
  25. public DataTableMappingCollection()
  26. {
  27. sourceTableList = new ArrayList ();
  28. dataSetTableList = new ArrayList ();
  29. mappingList = new ArrayList ();
  30. }
  31. public int Add (object value)
  32. {
  33. if (!(value is System.Data.Common.DataTableMapping))
  34. throw new SystemException ("The object passed in was not a DataTableMapping object.");
  35. string sourceTable = ((DataTableMapping)value).SourceTable;
  36. string dataSetTable = ((DataTableMapping)value).DataSetTable;
  37. mappingList.Add (value);
  38. dataSetTableList.Add (dataSetTable);
  39. return sourceTableList.Add (sourceTable);
  40. }
  41. public DataTableMapping Add (string sourceTable, string dataSetTable)
  42. {
  43. DataTableMapping dataTableMapping = new DataTableMapping (sourceTable, dataSetTable);
  44. mappingList.Add (dataTableMapping);
  45. sourceTableList.Add (sourceTable);
  46. dataSetTableList.Add (dataSetTable);
  47. return dataTableMapping ;
  48. }
  49. public void AddRange(DataTableMapping[] values)
  50. {
  51. foreach (DataTableMapping dataTableMapping in values)
  52. this.Add (dataTableMapping);
  53. }
  54. public void Clear()
  55. {
  56. sourceTableList.Clear ();
  57. dataSetTableList.Clear ();
  58. mappingList.Clear ();
  59. }
  60. public bool Contains (object value)
  61. {
  62. return mappingList.Contains (value);
  63. }
  64. public bool Contains (string value)
  65. {
  66. return sourceTableList.Contains (value);
  67. }
  68. [MonoTODO]
  69. public void CopyTo(Array array, int index)
  70. {
  71. throw new NotImplementedException ();
  72. }
  73. public DataTableMapping GetByDataSetTable (string dataSetTable)
  74. {
  75. return (DataTableMapping)mappingList[dataSetTableList.IndexOf(dataSetTable)];
  76. }
  77. [MonoTODO]
  78. public static DataTableMapping GetTableMappingBySchemaAction (DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
  79. {
  80. throw new NotImplementedException ();
  81. }
  82. public int IndexOf (object value)
  83. {
  84. return mappingList.IndexOf (value);
  85. }
  86. public int IndexOf (string value)
  87. {
  88. return sourceTableList.IndexOf (value);
  89. }
  90. public int IndexOfDataSetTable (string dataSetTable)
  91. {
  92. return dataSetTableList.IndexOf (dataSetTable);
  93. }
  94. [MonoTODO]
  95. public void Insert (int index, object value)
  96. {
  97. throw new NotImplementedException ();
  98. }
  99. [MonoTODO]
  100. public void Remove (object value)
  101. {
  102. throw new NotImplementedException ();
  103. }
  104. [MonoTODO]
  105. public void RemoveAt (int index)
  106. {
  107. throw new NotImplementedException ();
  108. }
  109. [MonoTODO]
  110. public void RemoveAt (string index)
  111. {
  112. throw new NotImplementedException ();
  113. }
  114. [MonoTODO]
  115. public int Count
  116. {
  117. get { throw new NotImplementedException (); }
  118. }
  119. [MonoTODO]
  120. public DataTableMapping this[int i] {
  121. get { throw new NotImplementedException (); }
  122. set { throw new NotImplementedException (); }
  123. }
  124. [MonoTODO]
  125. public DataTableMapping this[string s] {
  126. get { throw new NotImplementedException (); }
  127. set { throw new NotImplementedException (); }
  128. }
  129. [MonoTODO]
  130. public IEnumerator GetEnumerator ()
  131. {
  132. throw new NotImplementedException ();
  133. }
  134. }
  135. }