DataTableMapping.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // System.Data.Common.DataTableMapping.cs
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. //
  7. // (C) Ximian, Inc
  8. //
  9. using System.Data;
  10. namespace System.Data.Common
  11. {
  12. /// <summary>
  13. /// Contains a description of a mapped relationship between a source table and a DataTable. This class is used by a DataAdapter when populating a DataSet.
  14. /// </summary>
  15. public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable
  16. {
  17. #region Fields
  18. string sourceTable;
  19. string dataSetTable;
  20. DataColumnMappingCollection columnMappings;
  21. #endregion
  22. #region Constructors
  23. public DataTableMapping ()
  24. {
  25. dataSetTable = String.Empty;
  26. sourceTable = String.Empty;
  27. columnMappings = new DataColumnMappingCollection ();
  28. }
  29. public DataTableMapping (string sourceTable, string dataSetTable)
  30. : this ()
  31. {
  32. this.sourceTable = sourceTable;
  33. this.dataSetTable = dataSetTable;
  34. }
  35. public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings)
  36. : this (sourceTable, dataSetTable)
  37. {
  38. this.columnMappings.AddRange (columnMappings);
  39. }
  40. #endregion
  41. #region Properties
  42. public DataColumnMappingCollection ColumnMappings {
  43. get { return columnMappings; }
  44. }
  45. public string DataSetTable {
  46. get { return dataSetTable; }
  47. set { dataSetTable = value; }
  48. }
  49. public string SourceTable {
  50. get { return sourceTable; }
  51. set { sourceTable = value; }
  52. }
  53. IColumnMappingCollection ITableMapping.ColumnMappings {
  54. get { return ColumnMappings; }
  55. }
  56. #endregion
  57. #region Methods
  58. public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction)
  59. {
  60. return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction);
  61. }
  62. [MonoTODO]
  63. public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction)
  64. {
  65. throw new NotImplementedException ();
  66. }
  67. [MonoTODO]
  68. object ICloneable.Clone ()
  69. {
  70. throw new NotImplementedException ();
  71. }
  72. public override string ToString ()
  73. {
  74. return SourceTable;
  75. }
  76. #endregion
  77. }
  78. }