#region Properties
[Browsable (false)]
+#if !NET_2_0
[DataSysDescription ("The number of items in the collection")]
+#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public int Count {
get { return mappings.Count; }
}
[Browsable (false)]
+#if !NET_2_0
[DataSysDescription ("The specified DataTableMapping object")]
+#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DataTableMapping this [int index] {
get { return (DataTableMapping)(mappings[index]); }
}
[Browsable (false)]
+#if !NET_2_0
[DataSysDescription ("The specified DataTableMapping object")]
+#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DataTableMapping this [string sourceTable] {
get { return (DataTableMapping) sourceTables[sourceTable]; }
}
#if NET_2_0
- [MonoTODO]
public void AddRange (Array values)
{
- throw new NotImplementedException ();
+ for (int i = 0; i < values.Length; ++i)
+ Add (values.GetValue (i));
}
#endif
mappings.CopyTo (array, index);
}
+#if NET_2_0
+ public void CopyTo (DataTableMapping[] array, int index)
+ {
+ mappings.CopyTo (array, index);
+ }
+#endif
+
public DataTableMapping GetByDataSetTable (string dataSetTable)
{
if (tableMappings.Contains (sourceTable))
return tableMappings[sourceTable];
if (mappingAction == MissingMappingAction.Error)
- throw new InvalidOperationException ();
+ throw new InvalidOperationException (String.Format ("Missing source table mapping: '{0}'",
+ sourceTable));
if (mappingAction == MissingMappingAction.Ignore)
return null;
return new DataTableMapping (sourceTable, dataSetTable);
dataSetTables[((DataTableMapping)value).DataSetTable] = value;
}
+#if NET_2_0
+ public void Insert (int index, DataTableMapping value)
+ {
+ mappings.Insert (index, value);
+ sourceTables[value.SourceTable] = value;
+ dataSetTables[value.DataSetTable] = value;
+ }
+#endif
+
ITableMapping ITableMappingCollection.Add (string sourceTableName, string dataSetTableName)
{
ITableMapping tableMapping = new DataTableMapping (sourceTableName, dataSetTableName);
throw new InvalidCastException ();
int index = mappings.IndexOf (value);
if (( index < 0 ) || (index >=mappings.Count))
- throw new ArgumentException("There is no such element in collection.");
+ throw new ArgumentException("There is no such element in collection.");
+ mappings.Remove ((DataTableMapping) value);
+ }
+#if NET_2_0
+ public void Remove (DataTableMapping value)
+ {
+ int index = mappings.IndexOf (value);
+ if (( index < 0 ) || (index >=mappings.Count))
+ throw new ArgumentException("There is no such element in collection.");
mappings.Remove ((DataTableMapping) value);
}
+#endif
public void RemoveAt (int index)
{