Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DataTableMapping.cs « System.Data.Common « System.Data « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 426406e958d3986915dd5eb76ab26168c8ee6de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// System.Data.Common.DataTableMapping.cs
//
// Author:
//   Rodrigo Moya (rodrigo@ximian.com)
//
// (C) Ximian, Inc
//

using System.Data;

namespace System.Data.Common
{
	/// <summary>
	/// 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.
	/// </summary>
	public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable
	{
		#region Fields

		string sourceTable;
		string dataSetTable;
		DataColumnMappingCollection columnMappings;

		#endregion

		#region Constructors

		public DataTableMapping () 
		{
			dataSetTable = String.Empty;
			sourceTable = String.Empty;
			columnMappings = new DataColumnMappingCollection ();
		}

		public DataTableMapping (string sourceTable, string dataSetTable) 
			: this ()
		{
			this.sourceTable = sourceTable;
			this.dataSetTable = dataSetTable;
		}
		
		public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings) 
			: this (sourceTable, dataSetTable)
		{
			this.columnMappings.AddRange (columnMappings);
		}

		#endregion

		#region Properties

		public DataColumnMappingCollection ColumnMappings {
			get { return columnMappings; }
		}

		public string DataSetTable {
			get { return dataSetTable; } 
			set { dataSetTable = value; }
		}

		public string SourceTable {
			get { return sourceTable; }
			set { sourceTable = value; }
		}

		IColumnMappingCollection ITableMapping.ColumnMappings {
			get { return ColumnMappings; }
		}
	
		#endregion

		#region Methods

		public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction) 
		{
			return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction);
		}

		[MonoTODO]
		public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction) 
		{
			throw new NotImplementedException ();
		}

		[MonoTODO]
		object ICloneable.Clone ()
		{
			throw new NotImplementedException ();
		}

		public override string ToString ()
		{
			return SourceTable; 
		}
		
		#endregion
	}
}