diff options
author | Tim Coleman <tim@mono-cvs.ximian.com> | 2002-11-12 04:41:04 +0300 |
---|---|---|
committer | Tim Coleman <tim@mono-cvs.ximian.com> | 2002-11-12 04:41:04 +0300 |
commit | ee1c3a66820f24382d69372a93796073ff24a215 (patch) | |
tree | 53b7ba608d17c3d36c191c31943cb1164afe08e8 | |
parent | bfdbb8d19b45d9a41dc26f18ca4a60f3c9552ecb (diff) |
2002-11-11 Tim Coleman <tim@timcoleman.com>
* System.Data/ResDescriptionAttribute.cs:
* list
New internal class added
* System.Data/Constraint.cs:
* System.Data/ConstraintCollection.cs:
* System.Data/DBConcurrencyException.cs:
* System.Data/DataColumn.cs:
* System.Data/DataColumnCollection.cs:
* System.Data/DataRelation.cs:
* System.Data/DataRelationCollection.cs:
* System.Data/DataRow.cs:
* System.Data/DataRowBuilder.cs:
* System.Data/DataRowBuilder.cs:
* System.Data/DataRowCollection.cs:
* System.Data/DataSet.cs:
* System.Data/DataTable.cs:
* System.Data/DataTableCollection.cs:
* System.Data/DataView.cs:
* System.Data/DataViewManager.cs:
* System.Data/DataViewSetting.cs:
* System.Data/DataViewSettingCollection.cs:
* System.Data/ForeignKeyConstraint.cs:
* System.Data/ForeignKeyConstraint.cs:
* System.Data/InternalDataCollectionBase.cs:
* System.Data/MergeFailedEventArgs.cs:
* System.Data/StrongTypingException.cs:
* System.Data/TypeDataSetGeneratorException.cs:
* System.Data/UniqueConstraint.cs:
* System.Data.Common/DataAdapter.cs:
* System.Data.Common/DataColumnMapping.cs:
* System.Data.Common/DataColumnMappingCollection.cs:
* System.Data.Common/DataTableMapping.cs:
* System.Data.Common/DataTableMappingCollection.cs:
* System.Data.Common/DbDataAdapter.cs:
* System.Data.Common/DbDataPermission.cs:
* System.Data.Common/DbDataPermissionAttribute.cs:
* System.Data.Common/DbEnumerator.cs:
* System.Data.SqlClient/SqlCommand.cs:
* System.Data.SqlClient/SqlCommandBuilder.cs:
* System.Data.SqlClient/SqlConnection.cs:
* System.Data.SqlClient/SqlDataAdapter.cs:
* System.Data.SqlClient/SqlParameter.cs:
Add missing attributes, methods, properties based on information
from System.Data class status page on go-mono.com.
svn path=/trunk/mcs/; revision=8927
39 files changed, 1201 insertions, 694 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/DataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs index 2ec749be1c0..9b507ea0fda 100644 --- a/mcs/class/System.Data/System.Data.Common/DataAdapter.cs +++ b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs @@ -44,38 +44,52 @@ namespace System.Data.Common #region Properties + [DataCategory ("Fill")] + [DataSysDescription ("Whether or not Fill will call DataRow.AcceptChanges.")] + [DefaultValue (true)] public bool AcceptChangesDuringFill { get { return acceptChangesDuringFill; } set { acceptChangesDuringFill = value; } } + [DataCategory ("Update")] + [DataSysDescription ("Whether or not to continue to the next DataRow when the Update events, RowUpdating and RowUpdated, Status is UpdateStatus.ErrorsOccurred.")] + [DefaultValue (false)] public bool ContinueUpdateOnError { get { return continueUpdateOnError; } set { continueUpdateOnError = value; } } + ITableMappingCollection IDataAdapter.TableMappings { + get { return TableMappings; } + } + + [DataCategory ("Mapping")] + [DataSysDescription ("The action taken when a table or column in the TableMappings is missing.")] + [DefaultValue (MissingMappingAction.Passthrough)] public MissingMappingAction MissingMappingAction { get { return missingMappingAction; } set { missingMappingAction = value; } } + [DataCategory ("Mapping")] + [DataSysDescription ("The action taken when a table or column in the DataSet is missing.")] + [DefaultValue (MissingSchemaAction.Add)] public MissingSchemaAction MissingSchemaAction { get { return missingSchemaAction; } set { missingSchemaAction = value; } } + [DataCategory ("Mapping")] + [DataSysDescription ("How to map source table to DataSet table.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public DataTableMappingCollection TableMappings { get { return tableMappings; } } - ITableMappingCollection IDataAdapter.TableMappings { - get { return TableMappings; } - } - #endregion #region Methods - [MonoTODO] protected virtual DataAdapter CloneInternals () diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs index b38f62532ec..e25bb52cf09 100644 --- a/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs +++ b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs @@ -1,64 +1,85 @@ // // System.Data.Common.DataColumnMapping // -// Author: +// Authors: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002 // +using System.ComponentModel; using System.Data; -namespace System.Data.Common -{ - /// <summary> - /// Contains a generic column mapping for an object that inherits from DataAdapter. This class cannot be inherited. - /// </summary> +namespace System.Data.Common { public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable { - private string srcColumn; - private string dsColumn; + #region Fields + + string sourceColumn; + string dataSetColumn; + + #endregion // Fields + + #region Constructors - public DataColumnMapping () { - srcColumn = null; - dsColumn = null; + public DataColumnMapping () + { + sourceColumn = String.Empty; + dataSetColumn = String.Empty; } - public DataColumnMapping(string sc, string dc) { - srcColumn = sc; - dsColumn = dc; + public DataColumnMapping (string sourceColumn, string dataSetColumn) + { + this.sourceColumn = sourceColumn; + this.dataSetColumn = dataSetColumn; } - [MonoTODO] - public DataColumn GetDataColumnBySchemaAction ( - DataTable dataTable, - Type dataType, - MissingSchemaAction schemaAction) { - throw new NotImplementedException (); - } + #endregion // Constructors + + #region Properties + [DataSysDescription ("DataColumn.ColumnName")] + [DefaultValue ("")] public string DataSetColumn { - get { - return this.dsColumn; - } - set { - this.dsColumn = value; - } + get { return dataSetColumn; } + set { dataSetColumn = value; } + } + + [DataSysDescription ("Source column name - case sensitive.")] + [DefaultValue ("")] + public string SourceColumn { + get { return sourceColumn; } + set { sourceColumn = value; } + } + + #endregion // Properties + + #region Methods + + [EditorBrowsable (EditorBrowsableState.Advanced)] + public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) + { + if (dataTable.Columns.Contains (dataSetColumn)) + return dataTable.Columns [dataSetColumn]; + if (schemaAction == MissingSchemaAction.Ignore) + return null; + if (schemaAction == MissingSchemaAction.Error) + throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn)); + return new DataColumn (dataSetColumn, dataType); } - [MonoTODO] object ICloneable.Clone () { - throw new NotImplementedException (); + return new DataColumnMapping (SourceColumn, DataSetColumn); } - public string SourceColumn { - get { - return this.srcColumn; - } - set { - this.srcColumn = value; - } + public override string ToString () + { + return SourceColumn; } + + #endregion // Methods } } diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs index cf3a7ac7a8f..83dfdefc6e4 100644 --- a/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs +++ b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs @@ -1,21 +1,20 @@ // -// System.Data.Common.DataColumnCollection +// System.Data.Common.DataColumnMappingCollection // -// Author: +// Authors: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002 // using System; using System.Collections; +using System.ComponentModel; using System.Data; -namespace System.Data.Common -{ - /// <summary> - /// Contains a collection of DataColumnMapping objects. This class cannot be inherited. - /// </summary> +namespace System.Data.Common { public sealed class DataColumnMappingCollection : MarshalByRefObject, IColumnMappingCollection , IList, ICollection, IEnumerable { #region Fields @@ -24,7 +23,7 @@ namespace System.Data.Common Hashtable sourceColumns; Hashtable dataSetColumns; - #endregion + #endregion // Fields #region Constructors @@ -35,15 +34,20 @@ namespace System.Data.Common dataSetColumns = new Hashtable (); } - #endregion + #endregion // Constructors #region Properties + [Browsable (false)] + [DataSysDescription ("The number of items in the collection")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public int Count { get { return list.Count; } } - public DataColumnMapping this[int index] { + [Browsable (false)] + [DataSysDescription ("The specified DataColumnMapping object.")] + public DataColumnMapping this [int index] { get { return (DataColumnMapping)(list[index]); } set { DataColumnMapping mapping = (DataColumnMapping)(list[index]); @@ -53,9 +57,9 @@ namespace System.Data.Common } } - public DataColumnMapping this[string sourceColumn] { - get { return (DataColumnMapping)(sourceColumns[sourceColumn]); } - set { this[list.IndexOf (sourceColumns[sourceColumn])] = value; } + public DataColumnMapping this [string sourceColumn] { + get { return (DataColumnMapping) sourceColumns[sourceColumn]; } + set { this [list.IndexOf (sourceColumns[sourceColumn])] = value; } } object ICollection.SyncRoot { @@ -66,21 +70,21 @@ namespace System.Data.Common get { return list.IsSynchronized; } } - object IColumnMappingCollection.this[string sourceColumn] { - get { return this[sourceColumn]; } + object IColumnMappingCollection.this [string sourceColumn] { + get { return this [sourceColumn]; } set { if (!(value is DataColumnMapping)) throw new ArgumentException (); - this[sourceColumn] = (DataColumnMapping)value; + this [sourceColumn] = (DataColumnMapping) value; } } - object IList.this[int index] { + object IList.this [int index] { get { return this[index]; } set { if (!(value is DataColumnMapping)) throw new ArgumentException (); - this[index] = (DataColumnMapping)value; + this [index] = (DataColumnMapping) value; } } @@ -92,8 +96,7 @@ namespace System.Data.Common get { return false; } } - - #endregion + #endregion // Properties #region Methods @@ -146,17 +149,15 @@ namespace System.Data.Common return (DataColumnMapping)(dataSetColumns[value]); } + [EditorBrowsable (EditorBrowsableState.Advanced)] public static DataColumnMapping GetColumnMappingBySchemaAction (DataColumnMappingCollection columnMappings, string sourceColumn, MissingMappingAction mappingAction) { if (columnMappings.Contains (sourceColumn)) return columnMappings[sourceColumn]; - if (mappingAction == MissingMappingAction.Ignore) return null; - if (mappingAction == MissingMappingAction.Error) - throw new SystemException (); - + throw new InvalidOperationException (String.Format ("Missing SourceColumn mapping for '{0}'", sourceColumn)); return new DataColumnMapping (sourceColumn, sourceColumn); } @@ -214,6 +215,6 @@ namespace System.Data.Common RemoveAt (list.IndexOf (sourceColumns[sourceColumn])); } - #endregion + #endregion // Methods } } diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs index 426406e958d..04f3dcaebc8 100644 --- a/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs +++ b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs @@ -1,19 +1,18 @@ // // System.Data.Common.DataTableMapping.cs // -// Author: +// Authors: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002 // +using System.ComponentModel; 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> +namespace System.Data.Common { public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable { #region Fields @@ -22,7 +21,7 @@ namespace System.Data.Common string dataSetTable; DataColumnMappingCollection columnMappings; - #endregion + #endregion // Fields #region Constructors @@ -46,47 +45,59 @@ namespace System.Data.Common this.columnMappings.AddRange (columnMappings); } - #endregion + #endregion // Constructors #region Properties + [DataSysDescription ("Individual columns mappings when this table mapping is matched.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public DataColumnMappingCollection ColumnMappings { get { return columnMappings; } } + [DataSysDescription ("DataTable.TableName")] + [DefaultValue ("")] public string DataSetTable { get { return dataSetTable; } set { dataSetTable = value; } } + IColumnMappingCollection ITableMapping.ColumnMappings { + get { return ColumnMappings; } + } + + [DataSysDescription ("The DataTableMapping source table name. This name is case sensitive.")] + [DefaultValue ("")] public string SourceTable { get { return sourceTable; } set { sourceTable = value; } } - IColumnMappingCollection ITableMapping.ColumnMappings { - get { return ColumnMappings; } - } - - #endregion + #endregion // Properties #region Methods + [EditorBrowsable (EditorBrowsableState.Advanced)] public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction) { return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction); } - [MonoTODO] + [EditorBrowsable (EditorBrowsableState.Advanced)] public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction) { - throw new NotImplementedException (); + if (dataSet.Tables.Contains (DataSetTable)) + return dataSet.Tables [DataSetTable]; + if (schemaAction == MissingSchemaAction.Ignore) + return null; + if (schemaAction == MissingSchemaAction.Error) + throw new InvalidOperationException (String.Format ("Missing the '{0} DataTable for the '{1}' SourceTable", DataSetTable, SourceTable)); + return new DataTable (DataSetTable); } - [MonoTODO] object ICloneable.Clone () { - throw new NotImplementedException (); + return new DataTableMapping (SourceTable, DataSetTable); } public override string ToString () @@ -94,6 +105,6 @@ namespace System.Data.Common return SourceTable; } - #endregion + #endregion // Methods } } diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs index 614b979a1b9..30d71ff489a 100644 --- a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs +++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs @@ -11,12 +11,10 @@ using System; using System.Collections; +using System.ComponentModel; -namespace System.Data.Common -{ - /// <summary> - /// A collection of DataTableMapping objects. This class cannot be inherited. - /// </summary> +namespace System.Data.Common { + [ListBindable (false)] public sealed class DataTableMappingCollection : MarshalByRefObject, ITableMappingCollection, IList, ICollection, IEnumerable { #region Fields @@ -36,33 +34,38 @@ namespace System.Data.Common dataSetTables = new Hashtable (); } - #endregion + #endregion // Constructors #region Properties - public int Count - { + [DataSysDescription ("The number of items in the collection")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public int Count { get { return mappings.Count; } } - public DataTableMapping this[int index] { + [Browsable (false)] + [DataSysDescription ("The specified DataTableMapping object")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataTableMapping this [int index] { get { return (DataTableMapping)(mappings[index]); } set { - DataTableMapping mapping = (DataTableMapping)(mappings[index]); - sourceTables[mapping.SourceTable] = value; - dataSetTables[mapping.DataSetTable] = value; - mappings[index] = value; + DataTableMapping mapping = (DataTableMapping) mappings[index]; + sourceTables [mapping.SourceTable] = value; + dataSetTables [mapping.DataSetTable] = value; + mappings [index] = value; } } - [MonoTODO] - public DataTableMapping this[string sourceTable] { - get { return (DataTableMapping)(sourceTables[sourceTable]); } - set { this[mappings.IndexOf(sourceTables[sourceTable])] = value; } + [Browsable (false)] + [DataSysDescription ("The specified DataTableMapping object")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataTableMapping this [string sourceTable] { + get { return (DataTableMapping) sourceTables[sourceTable]; } + set { this [mappings.IndexOf (sourceTables[sourceTable])] = value; } } - - object IList.this[int index] { + object IList.this [int index] { get { return (object)(this[index]); } set { if (!(value is DataTableMapping)) @@ -71,32 +74,32 @@ namespace System.Data.Common } } - bool IList.IsReadOnly { - get { return false; } - } - - bool IList.IsFixedSize { - get { return false; } + bool ICollection.IsSynchronized { + get { return mappings.IsSynchronized; } } object ICollection.SyncRoot { get { return mappings.SyncRoot; } } - bool ICollection.IsSynchronized { - get { return mappings.IsSynchronized; } + bool IList.IsFixedSize { + get { return false; } } - object ITableMappingCollection.this[string sourceTable] { - get { return this[sourceTable]; } + bool IList.IsReadOnly { + get { return false; } + } + + object ITableMappingCollection.this [string sourceTable] { + get { return this [sourceTable]; } set { if (!(value is DataTableMapping)) throw new ArgumentException (); - this[sourceTable] = (DataTableMapping)(value); + this [sourceTable] = (DataTableMapping) value; } } - #endregion + #endregion // Properties #region Methods @@ -117,13 +120,13 @@ namespace System.Data.Common return mapping; } - public void AddRange(DataTableMapping[] values) + public void AddRange (DataTableMapping[] values) { foreach (DataTableMapping dataTableMapping in values) this.Add (dataTableMapping); } - public void Clear() + public void Clear () { sourceTables.Clear (); dataSetTables.Clear (); @@ -140,10 +143,9 @@ namespace System.Data.Common return sourceTables.Contains (value); } - [MonoTODO] - public void CopyTo(Array array, int index) + public void CopyTo (Array array, int index) { - throw new NotImplementedException (); + mappings.CopyTo (array, index); } public DataTableMapping GetByDataSetTable (string dataSetTable) @@ -151,6 +153,7 @@ namespace System.Data.Common return (DataTableMapping)(dataSetTables[dataSetTable]); } + [EditorBrowsable (EditorBrowsableState.Advanced)] public static DataTableMapping GetTableMappingBySchemaAction (DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction) { if (tableMappings.Contains (sourceTable)) @@ -182,44 +185,38 @@ namespace System.Data.Common return IndexOf ((DataTableMapping)(dataSetTables[dataSetTable])); } - [MonoTODO] public void Insert (int index, object value) { - throw new NotImplementedException (); + mappings.Insert (index, value); } - [MonoTODO] ITableMapping ITableMappingCollection.Add (string sourceTableName, string dataSetTableName) { - throw new NotImplementedException (); + ITableMapping tableMapping = new DataTableMapping (sourceTableName, dataSetTableName); + Add (tableMapping); + return tableMapping; } - [MonoTODO] ITableMapping ITableMappingCollection.GetByDataSetTable (string dataSetTableName) { - throw new NotImplementedException (); + return this [mappings.IndexOf (dataSetTables [dataSetTableName])]; } - [MonoTODO] public void Remove (object value) { - throw new NotImplementedException (); + mappings.Remove ((DataTableMapping) value); } - [MonoTODO] public void RemoveAt (int index) { - throw new NotImplementedException (); + mappings.RemoveAt (index); } - [MonoTODO] - public void RemoveAt (string index) + public void RemoveAt (string sourceTable) { - throw new NotImplementedException (); + RemoveAt (mappings.IndexOf (sourceTables[sourceTable])); } - - - #endregion + #endregion // Methods } } diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs index aa507beab1e..678e7886b50 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs @@ -11,13 +11,10 @@ using System; using System.Collections; +using System.ComponentModel; using System.Data; -namespace System.Data.Common -{ - /// <summary> - /// Aids implementation of the IDbDataAdapter interface. Inheritors of DbDataAdapter implement a set of functions to provide strong typing, but inherit most of the functionality needed to fully implement a DataAdapter. - /// </summary> +namespace System.Data.Common { public abstract class DbDataAdapter : DataAdapter, ICloneable { #region Fields @@ -25,7 +22,7 @@ namespace System.Data.Common public const string DefaultSourceTableName = "Table"; const string DefaultSourceColumnName = "Column"; - #endregion + #endregion // Fields #region Constructors @@ -33,28 +30,36 @@ namespace System.Data.Common { } - #endregion + #endregion // Fields #region Properties IDbCommand DeleteCommand { - get { return ((IDbDataAdapter)this).DeleteCommand; } + get { return ((IDbDataAdapter) this).DeleteCommand; } } IDbCommand InsertCommand { - get { return ((IDbDataAdapter)this).InsertCommand; } + get { return ((IDbDataAdapter) this).InsertCommand; } } IDbCommand SelectCommand { - get { return ((IDbDataAdapter)this).SelectCommand; } + get { return ((IDbDataAdapter) this).SelectCommand; } } IDbCommand UpdateCommand { - get { return ((IDbDataAdapter)this).UpdateCommand; } + get { return ((IDbDataAdapter) this).UpdateCommand; } } - #endregion + #endregion // Properties + + #region Events + + [DataCategory ("Fill")] + [DataSysDescription ("Event triggered when a recoverable error occurs during Fill.")] + public event FillErrorEventHandler FillError; + + #endregion // Events #region Methods @@ -229,6 +234,7 @@ namespace System.Data.Common throw new NotImplementedException (); } + [EditorBrowsable (EditorBrowsableState.Advanced)] public override IDataParameter[] GetFillParameters () { object[] parameters = new object [SelectCommand.Parameters.Count]; @@ -311,7 +317,14 @@ namespace System.Data.Common int index = TableMappings.IndexOfDataSetTable (dataTable.TableName); if (index < 0) throw new ArgumentException (); - return Update ((DataRow[]) dataTable.Rows.List.ToArray (typeof (DataRow)), TableMappings[index]); + return Update (dataTable, TableMappings [index]); + } + + private int Update (DataTable dataTable, DataTableMapping tableMapping) + { + DataRow[] rows = new DataRow [dataTable.Rows.Count]; + dataTable.Rows.CopyTo (rows, 0); + return Update (rows, tableMapping); } [MonoTODO] @@ -386,8 +399,8 @@ namespace System.Data.Common { int result = 0; DataTableMapping tableMapping = TableMappings [sourceTable]; - foreach (DataTable table in dataSet.Tables) - result += Update ((DataRow[]) table.Rows.List.ToArray (typeof (DataRow)), tableMapping); + foreach (DataTable dataTable in dataSet.Tables) + result += Update (dataTable, tableMapping); return result; } @@ -401,11 +414,5 @@ namespace System.Data.Common protected abstract void OnRowUpdating (RowUpdatingEventArgs value); #endregion // Methods - - #region Events - - public event FillErrorEventHandler FillError; - - #endregion // Events } } diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs index a667509c83e..faf4ee88c61 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs @@ -13,9 +13,7 @@ using System.Security; using System.Security.Permissions; namespace System.Data.Common { - /// <summary> - /// Provides the capability for a .NET data provider to ensure that a user has a security level adequate for accessing data. - /// </summary> + [Serializable] public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission { private bool allowBlankPassword; diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs index 6968ba77ec3..02cff942be6 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs @@ -1,36 +1,47 @@ // // System.Data.Common.DbDataPermissionAttribute.cs // -// Author: +// Authors: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002 // +using System; using System.Security.Permissions; -namespace System.Data.Common -{ - /// <summary> - /// Associates a security action with a custom security attribute. - /// </summary> +namespace System.Data.Common { + [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)] + [Serializable] public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute { - private SecurityAction securityAction; - private bool allowBlankPassword; + #region Fields - protected DBDataPermissionAttribute (SecurityAction action) : base (action) { + SecurityAction securityAction; + bool allowBlankPassword; + + #endregion // Fields + + #region Constructors + + protected DBDataPermissionAttribute (SecurityAction action) + : base (action) + { securityAction = action; allowBlankPassword = false; } + #endregion // Constructors + + #region Properties + public bool AllowBlankPassword { - get { - return allowBlankPassword; - } - set { - allowBlankPassword = value; - } + get { return allowBlankPassword; } + set { allowBlankPassword = value; } } + + #endregion // Properties } } diff --git a/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs b/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs index cd8c5a1e520..39cded06a71 100644 --- a/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs +++ b/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs @@ -9,6 +9,7 @@ using System; using System.Collections; +using System.ComponentModel; using System.Data; namespace System.Data.Common { @@ -44,7 +45,7 @@ namespace System.Data.Common { #region Properties - public virtual object Current { + public object Current { get { object[] values = new object[fieldCount]; reader.GetValues (values); @@ -56,7 +57,7 @@ namespace System.Data.Common { #region Methods - public void LoadSchema (DataTable schemaTable) + private void LoadSchema (DataTable schemaTable) { schema = new SchemaInfo [fieldCount]; int index = 0; @@ -74,22 +75,22 @@ namespace System.Data.Common { columnSchema.IsReadOnly = (bool) row ["IsReadOnly"]; columnSchema.TableName = row ["BaseTableName"].ToString (); - if (row["NumericPrecision"] != DBNull.Value) - columnSchema.NumericPrecision = (byte) row["NumericPrecision"]; + if (row ["NumericPrecision"] != DBNull.Value) + columnSchema.NumericPrecision = (byte) row ["NumericPrecision"]; else columnSchema.NumericPrecision = (byte) 0; - if (row["NumericScale"] != DBNull.Value) - columnSchema.NumericScale = (byte) row["NumericScale"]; + if (row ["NumericScale"] != DBNull.Value) + columnSchema.NumericScale = (byte) row ["NumericScale"]; else columnSchema.NumericScale = (byte) 0; - schema[index] = columnSchema; + schema [index] = columnSchema; index += 1; } } - public virtual bool MoveNext () + public bool MoveNext () { if (reader.Read ()) return true; @@ -98,7 +99,8 @@ namespace System.Data.Common { return false; } - public virtual void Reset () + [EditorBrowsable (EditorBrowsableState.Never)] + public void Reset () { throw new NotSupportedException (); } diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 57e19cb0579..45b5ba922e1 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -82,6 +82,7 @@ namespace System.Data.SqlClient { get { return behavior; } } + [DataCategory ("Data")] [DataSysDescription ("Command text to execute.")] [DefaultValue ("")] [RefreshProperties (RefreshProperties.All)] @@ -101,6 +102,7 @@ namespace System.Data.SqlClient { } } + [DataCategory ("Data")] [DataSysDescription ("How to interpret the CommandText.")] [DefaultValue (CommandType.Text)] [RefreshProperties (RefreshProperties.All)] @@ -113,6 +115,7 @@ namespace System.Data.SqlClient { } } + [DataCategory ("Behavior")] [DefaultValue (null)] [DataSysDescription ("Connection used by the command.")] public SqlConnection Connection { @@ -133,6 +136,7 @@ namespace System.Data.SqlClient { set { designTimeVisible = value; } } + [DataCategory ("Data")] [DataSysDescription ("The parameters collection.")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public SqlParameterCollection Parameters { @@ -173,6 +177,7 @@ namespace System.Data.SqlClient { set { transaction = value; } } + [DataCategory ("Behavior")] [DataSysDescription ("When used by a DataAdapter.Update, how command results are applied to the current DataRow.")] [DefaultValue (UpdateRowSource.Both)] public UpdateRowSource UpdatedRowSource { diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs index 0c8038a5945..dcdf205b0c4 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs @@ -56,6 +56,8 @@ namespace System.Data.SqlClient { #region Properties + [DataSysDescription ("The DataAdapter for which to automatically generate SqlCommands")] + [DefaultValue (null)] public SqlDataAdapter DataAdapter { get { return adapter; } set { @@ -69,6 +71,9 @@ namespace System.Data.SqlClient { get { return GetQuotedString (tableName); } } + [Browsable (false)] + [DataSysDescription ("The character used in a text command as the opening quote for quoting identifiers that contain special characters.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public string QuotePrefix { get { return quotePrefix; } set { @@ -78,6 +83,9 @@ namespace System.Data.SqlClient { } } + [Browsable (false)] + [DataSysDescription ("The character used in a text command as the closing quote for quoting identifiers that contain special characters.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public string QuoteSuffix { get { return quoteSuffix; } set { diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs index 9c5c0deac5b..23ebfb35dc9 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs @@ -81,6 +81,7 @@ namespace System.Data.SqlClient { #region Properties + [DataCategory ("Data")] [DataSysDescription ("Information used to connect to a DataSource, such as 'Data Source=x;Initial Catalog=x;Integrated Security=SSPI'.")] [DefaultValue ("")] [RecommendedAsConfigurable (true)] @@ -156,8 +157,13 @@ namespace System.Data.SqlClient { #endregion // Properties #region Events - + + [DataCategory ("InfoMessage")] + [DataSysDescription ("Event triggered when messages arrive from the DataSource.")] public event SqlInfoMessageEventHandler InfoMessage; + + [DataCategory ("StateChange")] + [DataSysDescription ("Event triggered when the connection changes state.")] public event StateChangeEventHandler StateChange; #endregion // Events diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs index 779a098535a..8193bc333ae 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs @@ -57,6 +57,7 @@ namespace System.Data.SqlClient { #region Properties + [DataCategory ("Update")] [DataSysDescription ("Used during Update for deleted rows in DataSet.")] [DefaultValue (null)] public SqlCommand DeleteCommand { @@ -64,6 +65,7 @@ namespace System.Data.SqlClient { set { deleteCommand = value; } } + [DataCategory ("Update")] [DataSysDescription ("Used during Update for new rows in DataSet.")] [DefaultValue (null)] public SqlCommand InsertCommand { @@ -71,6 +73,7 @@ namespace System.Data.SqlClient { set { insertCommand = value; } } + [DataCategory ("Fill")] [DataSysDescription ("Used during Fill/FillSchema.")] [DefaultValue (null)] public SqlCommand SelectCommand { @@ -78,6 +81,7 @@ namespace System.Data.SqlClient { set { selectCommand = value; } } + [DataCategory ("Update")] [DataSysDescription ("Used during Update for modified rows in DataSet.")] [DefaultValue (null)] public SqlCommand UpdateCommand { @@ -157,9 +161,11 @@ namespace System.Data.SqlClient { #region Events and Delegates + [DataCategory ("Update")] [DataSysDescription ("Event triggered before every DataRow during Update.")] public event SqlRowUpdatedEventHandler RowUpdated; + [DataCategory ("Update")] [DataSysDescription ("Event triggered after every DataRow during Update.")] public event SqlRowUpdatingEventHandler RowUpdating; diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs index 8a0e422c893..10fb8e55539 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs @@ -123,14 +123,16 @@ namespace System.Data.SqlClient { #region Properties [Browsable (false)] + [DataCategory ("Data")] [DataSysDescription ("The parameter generic type.")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - //[RefreshProperties (RefreshProperties.All)] + [RefreshProperties (RefreshProperties.All)] public DbType DbType { get { return theDbType; } set { theDbType = value; } } + [DataCategory ("Data")] [DataSysDescription ("Input, output, or bidirectional parameter.")] [DefaultValue (ParameterDirection.Input)] public ParameterDirection Direction { @@ -138,6 +140,11 @@ namespace System.Data.SqlClient { set { direction = value; } } + string IDataParameter.ParameterName { + get { return parmName; } + set { parmName = value; } + } + [Browsable (false)] [DataSysDescription ("a design-time property used for strongly typed code-generation.")] [DefaultValue (false)] @@ -145,9 +152,11 @@ namespace System.Data.SqlClient { [EditorBrowsable (EditorBrowsableState.Advanced)] public bool IsNullable { get { return isNullable; } + set { isNullable = value; } } [Browsable (false)] + [DataCategory ("Data")] [DataSysDescription ("Offset in variable length data types.")] [DefaultValue (0)] public int Offset { @@ -155,11 +164,6 @@ namespace System.Data.SqlClient { set { offset = value; } } - string IDataParameter.ParameterName { - get { return parmName; } - set { parmName = value; } - } - [DataSysDescription ("Name of the parameter, like '@p1'")] [DefaultValue ("")] public string ParameterName { @@ -167,6 +171,7 @@ namespace System.Data.SqlClient { set { parmName = value; } } + [DataCategory ("Data")] [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")] [DefaultValue (0)] public byte Precision { @@ -174,6 +179,26 @@ namespace System.Data.SqlClient { set { precision = value; } } + [DataCategory ("Data")] + [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")] + [DefaultValue (0)] + public byte Scale { + get { return scale; } + set { scale = value; } + } + + [DataCategory ("Data")] + [DataSysDescription ("Size of variable length datatypes (strings & arrays).")] + [DefaultValue (0)] + public int Size { + get { return size; } + set { + sizeSet = true; + size = value; + } + } + + [DataCategory ("Data")] [DataSysDescription ("When used by a DataAdapter.Update, the source column name that is used to find the DataSetColumn name in the ColumnMappings. This is to copy a value between the parameter and a datarow.")] [DefaultValue ("")] public string SourceColumn { @@ -181,6 +206,7 @@ namespace System.Data.SqlClient { set { sourceColumn = value; } } + [DataCategory ("Data")] [DataSysDescription ("When used by a DataAdapter.Update (UpdateCommand only), the version of the DataRow value that is used to update the data source.")] [DefaultValue (DataRowVersion.Current)] public DataRowVersion SourceVersion { @@ -188,14 +214,16 @@ namespace System.Data.SqlClient { set { sourceVersion = value; } } + [DataCategory ("Data")] [DataSysDescription ("The parameter native type.")] [DefaultValue (SqlDbType.NVarChar)] - //[RefreshProperties (RefreshProperties.All)] + [RefreshProperties (RefreshProperties.All)] public SqlDbType SqlDbType { get { return dbtype; } set { dbtype = value; } } + [DataCategory ("Data")] [DataSysDescription ("Value of the parameter.")] [DefaultValue (null)] public object Value { @@ -203,23 +231,6 @@ namespace System.Data.SqlClient { set { objValue = value; } } - [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")] - [DefaultValue (0)] - public byte Scale { - get { return scale; } - set { scale = value; } - } - - [DataSysDescription ("Size of variable length datatypes (strings & arrays).")] - [DefaultValue (0)] - public int Size { - get { return size; } - set { - sizeSet = true; - size = value; - } - } - #endregion // Properties #region Methods diff --git a/mcs/class/System.Data/System.Data/Constraint.cs b/mcs/class/System.Data/System.Data/Constraint.cs index a58bd130d21..61e9bb4381d 100644 --- a/mcs/class/System.Data/System.Data/Constraint.cs +++ b/mcs/class/System.Data/System.Data/Constraint.cs @@ -4,9 +4,11 @@ // Author: // Franklin Wise <gracenote@earthlink.net> // Daniel Morgan +// Tim Coleman (tim@timcoleman.com) // // // (C) Ximian, Inc. 2002 +// Copyright (C) Tim Coleman, 2002 // using System; @@ -15,17 +17,15 @@ using System.ComponentModel; using System.Runtime.InteropServices; using System.Runtime.Serialization; -namespace System.Data -{ +namespace System.Data { [Serializable] - internal delegate void DelegateConstraintNameChange(object sender, - string newName); - + internal delegate void DelegateConstraintNameChange (object sender, string newName); + + [DefaultProperty ("ConstraintName")] [Serializable] public abstract class Constraint { - internal event DelegateConstraintNameChange - BeforeConstraintNameChange; + internal event DelegateConstraintNameChange BeforeConstraintNameChange; //if constraintName is not set then a name is //created when it is added to @@ -38,16 +38,23 @@ namespace System.Data //Used for membership checking private ConstraintCollection _constraintCollection; - protected Constraint() + DataSet dataSet; + + protected Constraint () { + dataSet = null; _properties = new PropertyCollection(); } - public virtual string ConstraintName { - get{ - return "" + _constraintName; - } + protected internal virtual DataSet _DataSet { + get { return dataSet; } + } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the name of this constraint.")] + [DefaultValue ("")] + public virtual string ConstraintName { + get{ return "" + _constraintName; } set{ //This should only throw an exception when it //is a member of a ConstraintCollection which @@ -58,54 +65,69 @@ namespace System.Data } } + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds custom user information.")] public PropertyCollection ExtendedProperties { - get { - return _properties; - } + get { return _properties; } } + [DataSysDescription ("Indicates the table of this constraint.")] public abstract DataTable Table { get; } - /// <summary> - /// Gets the ConstraintName, if there is one, as a string. - /// </summary> - public override string ToString() - { - return "" + _constraintName; - } - internal ConstraintCollection ConstraintCollection { - get{ - return _constraintCollection; - } - set{ - _constraintCollection = value; - } + get{ return _constraintCollection; } + set{ _constraintCollection = value; } } - - private void _onConstraintNameChange(string newName) + private void _onConstraintNameChange (string newName) { if (null != BeforeConstraintNameChange) { - BeforeConstraintNameChange(this, newName); + BeforeConstraintNameChange (this, newName); } } //call once before adding a constraint to a collection //will throw an exception to prevent the add if a rule is broken - internal virtual void AddToConstraintCollectionSetup( - ConstraintCollection collection){} + internal virtual void AddToConstraintCollectionSetup (ConstraintCollection collection) + { + } + internal virtual void AssertConstraint () + { + } + + internal virtual void AssertConstraint (DataRow row) + { + } + //call once before removing a constraint to a collection //can throw an exception to prevent the removal - internal virtual void RemoveFromConstraintCollectionCleanup( - ConstraintCollection collection){} + internal virtual void RemoveFromConstraintCollectionCleanup (ConstraintCollection collection) + { + } + + [MonoTODO] + protected void CheckStateForProperty () + { + throw new NotImplementedException (); + } + + protected internal void SetDataSet (DataSet dataSet) + { + this.dataSet = dataSet; + } + + /// <summary> + /// Gets the ConstraintName, if there is one, as a string. + /// </summary> + public override string ToString () + { + return "" + _constraintName; + } - internal virtual void AssertConstraint(){} - - internal virtual void AssertConstraint(DataRow row){} } } diff --git a/mcs/class/System.Data/System.Data/ConstraintCollection.cs b/mcs/class/System.Data/System.Data/ConstraintCollection.cs index 8bcbac72fc7..0a01173a87c 100644 --- a/mcs/class/System.Data/System.Data/ConstraintCollection.cs +++ b/mcs/class/System.Data/System.Data/ConstraintCollection.cs @@ -14,15 +14,14 @@ using System; using System.Collections; using System.ComponentModel; -namespace System.Data -{ +namespace System.Data { [Serializable] - internal delegate void DelegateValidateRemoveConstraint(ConstraintCollection sender, - Constraint constraintToRemove, ref bool fail,ref string failReason); + internal delegate void DelegateValidateRemoveConstraint(ConstraintCollection sender, Constraint constraintToRemove, ref bool fail,ref string failReason); /// <summary> /// hold collection of constraints for data table /// </summary> + [DefaultEvent ("CollectionChanged")] [Serializable] public class ConstraintCollection : InternalDataCollectionBase { @@ -314,8 +313,7 @@ namespace System.Data OnCollectionChanged( new CollectionChangeEventArgs(CollectionChangeAction.Remove,this)); } - - protected internal override ArrayList List { + protected override ArrayList List { get{ return base.List; } diff --git a/mcs/class/System.Data/System.Data/DBConcurrencyException.cs b/mcs/class/System.Data/System.Data/DBConcurrencyException.cs index 5fd78826b48..0d5247f5291 100644 --- a/mcs/class/System.Data/System.Data/DBConcurrencyException.cs +++ b/mcs/class/System.Data/System.Data/DBConcurrencyException.cs @@ -10,9 +10,8 @@ using System.Globalization; using System.Runtime.Serialization; namespace System.Data { - [Serializable] - public class DBConcurrencyException : SystemException + public sealed class DBConcurrencyException : SystemException { public DBConcurrencyException (string message) : base (message) diff --git a/mcs/class/System.Data/System.Data/DataColumn.cs b/mcs/class/System.Data/System.Data/DataColumn.cs index 579b4999a88..28accc9139a 100644 --- a/mcs/class/System.Data/System.Data/DataColumn.cs +++ b/mcs/class/System.Data/System.Data/DataColumn.cs @@ -6,24 +6,29 @@ // Christopher Podurgiel (cpodurgiel@msn.com) // Rodrigo Moya (rodrigo@ximian.com) // Daniel Morgan (danmorg@sc.rr.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Copyright 2002, Franklin Wise // (C) Chris Podurgiel // (C) Ximian, Inc 2002 // (C) Daniel Morgan 2002 +// Copyright (C) Tim Coleman, 2002 // using System; using System.ComponentModel; +using System.Reflection; -namespace System.Data -{ - internal delegate void DelegateColumnValueChange(DataColumn column, - DataRow row, object proposedValue); +namespace System.Data { + internal delegate void DelegateColumnValueChange(DataColumn column, DataRow row, object proposedValue); /// <summary> /// Summary description for DataColumn. /// </summary> + + [DefaultMember ("Item")] + [DefaultProperty ("ColumnName")] + [DesignTimeVisible (false)] public class DataColumn : MarshalByValueComponent { #region Events @@ -95,7 +100,10 @@ namespace System.Data #endregion #region Properties - + + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether null values are allowed in this column.")] + [DefaultValue (true)] public bool AllowDBNull { get { @@ -134,6 +142,10 @@ namespace System.Data /// (that is, the Expression property is set.) The incremented value is used only if the row's value for this column, /// when added to the columns collection, is equal to the default value. /// </remarks> + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether the column automatically increments itself for new rows added to the table. The type of this column must be Int16, Int32, or Int64.")] + [DefaultValue (false)] + [RefreshProperties (RefreshProperties.All)] public bool AutoIncrement { get { @@ -161,6 +173,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the starting value for an AutoIncrement column.")] + [DefaultValue (0)] public long AutoIncrementSeed { get { @@ -171,6 +186,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the increment used by an AutoIncrement column.")] + [DefaultValue (1)] public long AutoIncrementStep { get { @@ -181,6 +199,8 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the default user-interface caption for this column.")] public string Caption { get { @@ -193,7 +213,8 @@ namespace System.Data _caption = value; } } - + [DataSysDescription ("Indicates how this column persists in XML: as an attribute, element, simple content node, or nothing.")] + [DefaultValue (MappingType.Element)] public virtual MappingType ColumnMapping { get { @@ -204,6 +225,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the name used to look up this column in the Columns collection of a DataTable.")] + [RefreshProperties (RefreshProperties.All)] public string ColumnName { get { @@ -217,6 +241,10 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the type of data stored in this column.")] + [DefaultValue (typeof (string))] + [RefreshProperties (RefreshProperties.All)] public Type DataType { get { @@ -244,6 +272,8 @@ namespace System.Data /// <remarks>When AutoIncrement is set to true, there can be no default value.</remarks> /// <exception cref="System.InvalidCastException"></exception> /// <exception cref="System.ArgumentException"></exception> + [DataCategory ("Data")] + [DataSysDescription ("Indicates the default column value used when adding new rows to the table.")] public object DefaultValue { get { @@ -272,6 +302,10 @@ namespace System.Data } [MonoTODO] + [DataCategory ("Data")] + [DataSysDescription ("Indicates the value that this column computes for each row based on other columns instead of taking user input.")] + [DefaultValue ("")] + [RefreshProperties (RefreshProperties.All)] public string Expression { get { @@ -283,6 +317,9 @@ namespace System.Data } } + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds custom user information.")] public PropertyCollection ExtendedProperties { get { @@ -290,6 +327,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the maximum length of the value this column allows.")] + [DefaultValue (-1)] public int MaxLength { get { @@ -302,6 +342,8 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the XML uri for elements stored in this column.")] public string Namespace { get { @@ -313,6 +355,10 @@ namespace System.Data } //Need a good way to set the Ordinal when the column is added to a columnCollection. + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("Indicates the index of this column in the Columns collection.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public int Ordinal { get { @@ -326,6 +372,9 @@ namespace System.Data _ordinal = ordinal; } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the prefix used for this DataColumn in the xml representation.")] + [DefaultValue ("")] public string Prefix { get { @@ -336,6 +385,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether this column allows changes once a row has been added to the table.")] + [DefaultValue (false)] public bool ReadOnly { get { @@ -345,7 +397,11 @@ namespace System.Data readOnly = value; } } - + + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("Returns the DataTable to which this column belongs.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public DataTable Table { get { @@ -354,7 +410,11 @@ namespace System.Data } [MonoTODO] - public bool Unique + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether this column should restrict its values in the rows of the table to be unique.")] + [DefaultValue (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public bool Unique { get { return unique; diff --git a/mcs/class/System.Data/System.Data/DataColumnCollection.cs b/mcs/class/System.Data/System.Data/DataColumnCollection.cs index 9e7fae7704d..bdf8ed762ef 100644 --- a/mcs/class/System.Data/System.Data/DataColumnCollection.cs +++ b/mcs/class/System.Data/System.Data/DataColumnCollection.cs @@ -4,20 +4,18 @@ // Author: // Christopher Podurgiel (cpodurgiel@msn.com) // Stuart Caborn <stuart.caborn@virgin.net> +// Tim Coleman (tim@timcoleman.com) // // (C) Chris Podurgiel +// Copyright (C) Tim Coleman, 2002 // using System; using System.Collections; using System.ComponentModel; -namespace System.Data -{ - /// <summary> - /// Represents a collection of DataColumn objects for a DataTable. - /// </summary> - [Serializable] +namespace System.Data { + [DefaultEvent ("CollectionChanged")] public class DataColumnCollection : InternalDataCollectionBase { // The defaultNameIndex is used to create a default name for a column if one wasn't given. @@ -65,7 +63,7 @@ namespace System.Data /// <summary> /// Gets a list of the DataColumnCollection items. /// </summary> - protected internal override ArrayList List + protected override ArrayList List { get { diff --git a/mcs/class/System.Data/System.Data/DataRelation.cs b/mcs/class/System.Data/System.Data/DataRelation.cs index bbc1f2eae5a..16984c90ee9 100644 --- a/mcs/class/System.Data/System.Data/DataRelation.cs +++ b/mcs/class/System.Data/System.Data/DataRelation.cs @@ -9,6 +9,7 @@ // using System; +using System.ComponentModel; using System.Runtime.Serialization; namespace System.Data @@ -17,48 +18,41 @@ namespace System.Data /// DataRelation is used for a parent/child relationship /// between two DataTable objects /// </summary> + [DefaultProperty ("RelationName")] [Serializable] public class DataRelation { #region Constructors [MonoTODO] - public DataRelation(string relationName, - DataColumn parentColumn, DataColumn childColumn) { - + public DataRelation (string relationName, DataColumn parentColumn, DataColumn childColumn) + { throw new NotImplementedException (); } [MonoTODO] - public DataRelation(string relationName, - DataColumn[] parentColumns, - DataColumn[] childColumns) { + public DataRelation (string relationName, DataColumn[] parentColumns, DataColumn[] childColumns) + { throw new NotImplementedException (); } [MonoTODO] - public DataRelation(string relationName, - DataColumn parentColumn, DataColumn childColumn, - bool createConstraints) { - + public DataRelation (string relationName, DataColumn parentColumn, DataColumn childColumn, bool createConstraints) + { throw new NotImplementedException (); } [MonoTODO] - public DataRelation(string relationName, - DataColumn[] parentColumns, DataColumn[] childColumns, - bool createConstraints) { - + public DataRelation (string relationName, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints) + { throw new NotImplementedException (); } [MonoTODO] - public DataRelation(string relationName, - string parentTableName, string childTableName, - string[] parentColumnNames, string[] childColumnNames, - bool nested) { - + [Browsable (false)] + public DataRelation (string relationName, string parentTableName, string childTableName, string[] parentColumnNames, string[] childColumnNames, bool nested) + { throw new NotImplementedException (); } @@ -66,6 +60,8 @@ namespace System.Data #region Properties + [DataCategory ("Data")] + [DataSysDescription ("Indicates the child columns of this relation.")] public virtual DataColumn[] ChildColumns { [MonoTODO] get { @@ -87,6 +83,8 @@ namespace System.Data } } + [Browsable (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public virtual DataSet DataSet { [MonoTODO] get { @@ -94,6 +92,9 @@ namespace System.Data } } + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds custom user information.")] public PropertyCollection ExtendedProperties { [MonoTODO] get { @@ -101,6 +102,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether relations are nested.")] + [DefaultValue (false)] public virtual bool Nested { [MonoTODO] get { @@ -113,6 +117,8 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the parent columns of this relation.")] public virtual DataColumn[] ParentColumns { [MonoTODO] get { @@ -134,6 +140,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("The name used to look up this relation in the Relations collection of a DataSet.")] + [DefaultValue ("")] public virtual string RelationName { [MonoTODO] get { @@ -151,12 +160,26 @@ namespace System.Data #region Methods [MonoTODO] - public override string ToString() { + protected void CheckStateForProperty () + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected internal void OnPropertyChanging (PropertyChangedEventArgs pcevent) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected internal void RaisePropertyChanging (string name) + { throw new NotImplementedException (); } [MonoTODO] - protected void CheckStateForProperty() { + public override string ToString () + { throw new NotImplementedException (); } diff --git a/mcs/class/System.Data/System.Data/DataRelationCollection.cs b/mcs/class/System.Data/System.Data/DataRelationCollection.cs index 6952e9829ac..455135f97ca 100644 --- a/mcs/class/System.Data/System.Data/DataRelationCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRelationCollection.cs @@ -4,20 +4,22 @@ // Author: // Christopher Podurgiel (cpodurgiel@msn.com) // Daniel Morgan <danmorg@sc.rr.com> +// Tim Coleman (tim@timcoleman.com) // // (C) Chris Podurgiel // (C) 2002 Daniel Morgan +// Copyright (C) Tim Coleman, 2002 // using System; using System.Collections; using System.ComponentModel; -namespace System.Data -{ +namespace System.Data { /// <summary> /// Represents the collection of DataRelation objects for this DataSet. /// </summary> + [DefaultEvent ("CollectionChanged")] [Serializable] public abstract class DataRelationCollection : InternalDataCollectionBase { @@ -27,7 +29,8 @@ namespace System.Data /// <summary> /// Initializes a new instance of the DataRelationCollection class. /// </summary> - internal DataRelationCollection() : base() + protected DataRelationCollection () + : base () { defaultNameIndex = 1; inTransition = false; @@ -282,6 +285,11 @@ namespace System.Data return false; } + private CollectionChangeEventArgs CreateCollectionChangeEvent (CollectionChangeAction action) + { + return new CollectionChangeEventArgs (action, this); + } + protected abstract DataSet GetDataSet(); public virtual int IndexOf(DataRelation relation) @@ -294,22 +302,33 @@ namespace System.Data return List.IndexOf(this[relationName]); } - [MonoTODO] - protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent) + protected virtual void OnCollectionChanged (CollectionChangeEventArgs ccevent) { - throw new NotImplementedException (); + if (CollectionChanged != null) + CollectionChanged (this, ccevent); } [MonoTODO] - protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent) + protected internal virtual void OnCollectionChanging (CollectionChangeEventArgs ccevent) { throw new NotImplementedException (); } - [MonoTODO] - public void RemoveAt(int index) + public void Remove (DataRelation relation) { - throw new NotImplementedException (); + RemoveCore (relation); + List.Remove (relation); + OnCollectionChanged (CreateCollectionChangeEvent (CollectionChangeAction.Remove)); + } + + public void Remove (string name) + { + Remove ((DataRelation) List[IndexOf (name)]); + } + + public void RemoveAt (int index) + { + List.RemoveAt (index); } [MonoTODO] @@ -318,7 +337,7 @@ namespace System.Data throw new NotImplementedException (); } + [ResDescriptionAttribute ("Occurs whenever this collection's membership changes.")] public event CollectionChangeEventHandler CollectionChanged; - } } diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs index adf6557a7dc..d1f24c886ea 100644 --- a/mcs/class/System.Data/System.Data/DataRow.cs +++ b/mcs/class/System.Data/System.Data/DataRow.cs @@ -14,11 +14,11 @@ using System; using System.Collections; -namespace System.Data -{ +namespace System.Data { /// <summary> /// Represents a row of data in a DataTable. /// </summary> + [Serializable] public class DataRow { #region Fields diff --git a/mcs/class/System.Data/System.Data/DataRowBuilder.cs b/mcs/class/System.Data/System.Data/DataRowBuilder.cs index 6ae8a8a8ca6..0e78cee8028 100644 --- a/mcs/class/System.Data/System.Data/DataRowBuilder.cs +++ b/mcs/class/System.Data/System.Data/DataRowBuilder.cs @@ -33,7 +33,7 @@ namespace System.Data // DataTable and two Int32. For consistency, this // class will also take those arguments. - protected internal DataRowBuilder (DataTable table, Int32 x, Int32 y) + internal DataRowBuilder (DataTable table, Int32 x, Int32 y) { this.table = table; } diff --git a/mcs/class/System.Data/System.Data/DataRowCollection.cs b/mcs/class/System.Data/System.Data/DataRowCollection.cs index 2b7a8dbac40..bc565469763 100644 --- a/mcs/class/System.Data/System.Data/DataRowCollection.cs +++ b/mcs/class/System.Data/System.Data/DataRowCollection.cs @@ -27,7 +27,7 @@ namespace System.Data /// <summary> /// Internal constructor used to build a DataRowCollection. /// </summary> - protected internal DataRowCollection (DataTable table) : base () + internal DataRowCollection (DataTable table) : base () { this.table = table; } @@ -43,7 +43,7 @@ namespace System.Data /// <summary> /// This member overrides InternalDataCollectionBase.List /// </summary> - protected internal override ArrayList List + protected override ArrayList List { get { return list; } } diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs index 3734c713f3e..7c53de95ab5 100644 --- a/mcs/class/System.Data/System.Data/DataSet.cs +++ b/mcs/class/System.Data/System.Data/DataSet.cs @@ -6,8 +6,10 @@ // Daniel Morgan <danmorg@sc.rr.com> // Rodrigo Moya <rodrigo@ximian.com> // Stuart Caborn <stuart.caborn@virgin.net> +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc. 2002 +// Copyright (C) Tim Coleman, 2002 // using System; @@ -18,11 +20,11 @@ using System.IO; using System.Runtime.Serialization; using System.Xml; -namespace System.Data -{ +namespace System.Data { /// <summary> /// an in-memory cache of data /// </summary> + [DefaultProperty ("DataSetName")] [Serializable] public class DataSet : MarshalByValueComponent, IListSource, ISupportInitialize, ISerializable { @@ -57,25 +59,24 @@ namespace System.Data #region Public Properties + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether comparing strings within the DataSet is case sensitive.")] + [DefaultValue (false)] public bool CaseSensitive { - get { - return caseSensitive; - } - set { - caseSensitive = value; - } + get { return caseSensitive; } + set { caseSensitive = value; } } + [DataCategory ("Data")] + [DataSysDescription ("The name of this DataSet.")] + [DefaultValue ("")] public string DataSetName { - get { - return dataSetName; - } - - set { - dataSetName = value; - } + get { return dataSetName; } + set { dataSetName = value; } } + [DataSysDescription ("Indicates a custom \"view\" of the data contained by the DataSet. This view allows filtering, searching, and navigating through the custom data view.")] + [Browsable (false)] public DataViewManager DefaultViewManager { [MonoTODO] get { @@ -88,23 +89,23 @@ namespace System.Data } } + [DataSysDescription ("Indicates whether constraint rules are to be followed.")] + [DefaultValue (true)] public bool EnforceConstraints { - get { - return enforceConstraints; - } - - set { - enforceConstraints = value; - } + get { return enforceConstraints; } + set { enforceConstraints = value; } } + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds custom user information.")] public PropertyCollection ExtendedProperties { [MonoTODO] - get { - return properties; - } + get { return properties; } } + [Browsable (false)] + [DataSysDescription ("Indicates that the DataSet has errors.")] public bool HasErrors { [MonoTODO] get { @@ -112,6 +113,8 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates a locale under which to compare strings within the DataSet.")] public CultureInfo Locale { [MonoTODO] get { @@ -124,12 +127,12 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the XML uri namespace for the root element pointed at by this DataSet.")] + [DefaultValue ("")] public string Namespace { [MonoTODO] - get { - return _namespace; - } - + get { return _namespace; } [MonoTODO] set { //TODO - trigger an event if this happens? @@ -137,12 +140,12 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the prefix of the namespace used for this DataSet.")] + [DefaultValue ("")] public string Prefix { [MonoTODO] - get { - return prefix; - } - + get { return prefix; } [MonoTODO] set { //TODO - trigger an event if this happens? @@ -150,6 +153,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds the relations for this DatSet.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public DataRelationCollection Relations { [MonoTODO] get{ @@ -158,6 +164,8 @@ namespace System.Data } } + [Browsable (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public override ISite Site { [MonoTODO] get { @@ -170,10 +178,11 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds the tables for this DataSet.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public DataTableCollection Tables { - get { - return tableCollection; - } + get { return tableCollection; } } #endregion // Public Properties @@ -360,6 +369,8 @@ namespace System.Data #region Public Events + [DataCategory ("Action")] + [DataSysDescription ("Occurs when it is not possible to merge schemas for two tables with the same name.")] public event MergeFailedEventHandler MergeFailed; #endregion // Public Events diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs index a86f5549ef8..9f03132aeca 100644 --- a/mcs/class/System.Data/System.Data/DataTable.cs +++ b/mcs/class/System.Data/System.Data/DataTable.cs @@ -6,9 +6,11 @@ // Christopher Podurgiel (cpodurgiel@msn.com) // Daniel Morgan <danmorg@sc.rr.com> // Rodrigo Moya <rodrigo@ximian.com> +// Tim Coleman (tim@timcoleman.com) // // (C) Chris Podurgiel // (C) Ximian, Inc 2002 +// Copyright (C) Tim Coleman, 2002 // using System; @@ -17,14 +19,12 @@ using System.ComponentModel; using System.Globalization; using System.Runtime.Serialization; -namespace System.Data -{ - /// <summary> - /// Represents one table of in-memory data. - /// </summary> - [Serializable]
- public class DataTable : MarshalByValueComponent, IListSource,
- ISupportInitialize, ISerializable +namespace System.Data { + [DefaultEvent ("RowChanging")] + [DefaultProperty ("TableName")] + [DesignTimeVisible (false)] + [Serializable] + public class DataTable : MarshalByValueComponent, IListSource, ISupportInitialize, ISerializable { internal DataSet dataSet; @@ -105,15 +105,10 @@ namespace System.Data /// <summary> /// Indicates whether string comparisons within the table are case-sensitive. /// </summary> - - public bool CaseSensitive - { - get { - return _caseSensitive; - } - set { - _caseSensitive = value; - } + [DataSysDescription ("Indicates whether comparing strings within the table is case sensitive.")] + public bool CaseSensitive { + get { return _caseSensitive; } + set { _caseSensitive = value; } } @@ -121,8 +116,10 @@ namespace System.Data /// Gets the collection of child relations for this DataTable. /// </summary> [MonoTODO] - public DataRelationCollection ChildRelations - { + [Browsable (false)] + [DataSysDescription ("Returns the child relations for this table.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataRelationCollection ChildRelations { get { // FIXME: temporarily commented to compile // return (DataRelationCollection)_childRelations; @@ -137,28 +134,29 @@ namespace System.Data /// <summary> /// Gets the collection of columns that belong to this table. /// </summary> - - public DataColumnCollection Columns - { - get { - return _columnCollection; - } + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds the columns for this table.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] + public DataColumnCollection Columns { + get { return _columnCollection; } } /// <summary> /// Gets the collection of constraints maintained by this table. /// </summary> - - public ConstraintCollection Constraints - { - get { - return _constraintCollection; - } + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds the constraints for this table.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] + public ConstraintCollection Constraints { + get { return _constraintCollection; } } /// <summary> /// Gets the DataSet that this table belongs to. /// </summary> + [Browsable (false)] + [DataSysDescription ("Indicates the DataSet to which this table belongs.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public DataSet DataSet { get { return dataSet; } } @@ -170,12 +168,10 @@ namespace System.Data /// include a filtered view, or a cursor position. /// </summary> [MonoTODO] - public DataView DefaultView - { - get - { - return _defaultView; - } + [Browsable (false)] + [DataSysDescription ("This is the default DataView for the table.")] + public DataView DefaultView { + get { return _defaultView; } } @@ -183,25 +179,22 @@ namespace System.Data /// Gets or sets the expression that will return /// a value used to represent this table in the user interface. /// </summary> - - public string DisplayExpression - { - get { - return "" + _displayExpression; - } - set { - _displayExpression = value; - } + [DataCategory ("Data")] + [DataSysDescription ("The expression used to compute the data-bound value of this row.")] + [DefaultValue ("")] + public string DisplayExpression { + get { return "" + _displayExpression; } + set { _displayExpression = value; } } /// <summary> /// Gets the collection of customized user information. /// </summary> - public PropertyCollection ExtendedProperties - { - get { - return _extendedProperties; - } + [Browsable (false)] + [DataCategory ("Data")] + [DataSysDescription ("The collection that holds custom user information.")] + public PropertyCollection ExtendedProperties { + get { return _extendedProperties; } } /// <summary> @@ -209,52 +202,42 @@ namespace System.Data /// any of the_rows in any of the tables of the DataSet to /// which the table belongs. /// </summary> - public bool HasErrors - { - get { - return _hasErrors; - } + [Browsable (false)] + [DataSysDescription ("Returns whether the table has errors.")] + public bool HasErrors { + get { return _hasErrors; } } /// <summary> /// Gets or sets the locale information used to /// compare strings within the table. /// </summary> - public CultureInfo Locale - { - get { - return _locale; - } - set { - _locale = value; - } + [DataSysDescription ("Indicates a locale under which to compare strings within the table.")] + public CultureInfo Locale { + get { return _locale; } + set { _locale = value; } } /// <summary> /// Gets or sets the initial starting size for this table. /// </summary> - public int MinimumCapacity - { - get { - return _minimumCapacity; - } - set { - _minimumCapacity = value; - } + [DataCategory ("Data")] + [DataSysDescription ("Indicates an initial starting size for this table.")] + [DefaultValue (50)] + public int MinimumCapacity { + get { return _minimumCapacity; } + set { _minimumCapacity = value; } } /// <summary> /// Gets or sets the namespace for the XML represenation /// of the data stored in the DataTable. /// </summary> - public string Namespace - { - get { - return "" + _nameSpace; - } - set { - _nameSpace = value; - } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the XML uri namespace for the elements contained in this table.")] + public string Namespace { + get { return "" + _nameSpace; } + set { _nameSpace = value; } } /// <summary> @@ -262,8 +245,10 @@ namespace System.Data /// this DataTable. /// </summary> [MonoTODO] - public DataRelationCollection ParentRelations - { + [Browsable (false)] + [DataSysDescription ("Returns the parent relations for this table.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataRelationCollection ParentRelations { get { // FIXME: temporarily commented to compile // return _parentRelations; @@ -275,20 +260,20 @@ namespace System.Data /// Gets or sets the namespace for the XML represenation /// of the data stored in the DataTable. /// </summary> - public string Prefix - { - get { - return "" + _prefix; - } - set { - _prefix = value; - } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the Prefix of the namespace used for this table in XML representation.")] + [DefaultValue ("")] + public string Prefix { + get { return "" + _prefix; } + set { _prefix = value; } } /// <summary> /// Gets or sets an array of columns that function as /// primary keys for the data table. /// </summary> + [DataCategory ("Data")] + [DataSysDescription ("Indicates the column(s) that represent the primary key for this table.")] public DataColumn[] PrimaryKey { get { @@ -330,9 +315,9 @@ namespace System.Data /// <summary> /// Gets the collection of_rows that belong to this table. /// </summary> - - public DataRowCollection Rows - { + [Browsable (false)] + [DataSysDescription ("Indicates the collection that holds the rows of data for this table.")] + public DataRowCollection Rows { get { return _rows; } } @@ -340,33 +325,26 @@ namespace System.Data /// Gets or sets an System.ComponentModel.ISite /// for the DataTable. /// </summary> - - public override ISite Site - { - get { - return _site; - } - set { - _site = value; - } + [Browsable (false)] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public override ISite Site { + get { return _site; } + set { _site = value; } } /// <summary> /// Gets or sets the name of the the DataTable. /// </summary> - - public string TableName - { - get { - return "" + _tableName; - } - set { - _tableName = value; - } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the name used to look up this table in the Tables collection of a DataSet.")] + [DefaultValue ("")] + [RefreshProperties (RefreshProperties.All)] + public string TableName { + get { return "" + _tableName; } + set { _tableName = value; } } - bool IListSource.ContainsListCollection - { + bool IListSource.ContainsListCollection { get { // the collection is a DataView return false; @@ -776,38 +754,44 @@ namespace System.Data /// Occurs when after a value has been changed for /// the specified DataColumn in a DataRow. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs when a value has been changed for this column.")] public event DataColumnChangeEventHandler ColumnChanged; /// <summary> /// Occurs when a value is being changed for the specified /// DataColumn in a DataRow. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs when a value has been submitted for this column. The user can modify the proposed value and should throw an exception to cancel the edit.")] public event DataColumnChangeEventHandler ColumnChanging; /// <summary> /// Occurs after a DataRow has been changed successfully. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs after a row in the table has been successfully edited.")] public event DataRowChangeEventHandler RowChanged; /// <summary> /// Occurs when a DataRow is changing. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs when the row is being changed so that the event handler can modify or cancel the change. The user can modify values in the row and should throw an exception to cancel the edit.")] public event DataRowChangeEventHandler RowChanging; /// <summary> /// Occurs after a row in the table has been deleted. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs after a row in the table has been successfully deleted.")] public event DataRowChangeEventHandler RowDeleted; /// <summary> /// Occurs before a row in the table is about to be deleted. /// </summary> - + [DataCategory ("Data")] + [DataSysDescription ("Occurs when a row in the table marked for deletion. Throw an exception to cancel the deletion.")] public event DataRowChangeEventHandler RowDeleting; #endregion //Events diff --git a/mcs/class/System.Data/System.Data/DataTableCollection.cs b/mcs/class/System.Data/System.Data/DataTableCollection.cs index 2a605448e6f..77e96642427 100644 --- a/mcs/class/System.Data/System.Data/DataTableCollection.cs +++ b/mcs/class/System.Data/System.Data/DataTableCollection.cs @@ -13,11 +13,13 @@ using System; using System.Collections; using System.ComponentModel; -namespace System.Data -{ +namespace System.Data { /// <summary> /// Represents the collection of tables for the DataSet. /// </summary> + [DefaultEvent ("CollectionChanged")] + [ListBindable (false)] + [Serializable] public class DataTableCollection : InternalDataCollectionBase { DataSet dataSet; @@ -26,8 +28,7 @@ namespace System.Data #region Constructors - // LAMESPEC: This constructor is undocumented - protected internal DataTableCollection (DataSet dataSet) + internal DataTableCollection (DataSet dataSet) : base () { this.dataSet = dataSet; @@ -38,10 +39,6 @@ namespace System.Data #region Properties - public override int Count { - get { return list.Count; } - } - public DataTable this[int index] { get { return (DataTable)(list[index]); } } @@ -50,7 +47,7 @@ namespace System.Data get { return (DataTable)(tables[name]); } } - protected internal override ArrayList List { + protected override ArrayList List { get { return list; } } @@ -130,8 +127,10 @@ namespace System.Data #endregion #region Events - + + [ResDescriptionAttribute ("Occurs whenever this collection's membership changes.")] public event CollectionChangeEventHandler CollectionChanged; + public event CollectionChangeEventHandler CollectionChanging; #endregion diff --git a/mcs/class/System.Data/System.Data/DataView.cs b/mcs/class/System.Data/System.Data/DataView.cs index 0b38c6bdc58..0c79cdc003a 100644 --- a/mcs/class/System.Data/System.Data/DataView.cs +++ b/mcs/class/System.Data/System.Data/DataView.cs @@ -3,8 +3,10 @@ // // Author: // Daniel Morgan <danmorg@sc.rr.com> +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc 2002 +// Copyright (C) Tim Coleman, 2002 // using System; @@ -18,8 +20,9 @@ namespace System.Data { /// a view of a DataTable for editing, filtering, /// navigation, searching, and sorting. /// </summary> - public class DataView : MarshalByValueComponent, IBindingList,
- IList, ICollection, IEnumerable, ITypedList, ISupportInitialize + [DefaultEvent ("PositionChanged")] + [DefaultProperty ("Table")] + public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize { DataTable dataTable = null; @@ -49,6 +52,9 @@ namespace System.Data { rowState = RowState; } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows deletes.")] + [DefaultValue (true)] public bool AllowDelete { [MonoTODO] get { @@ -61,6 +67,9 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows edits.")] + [DefaultValue (true)] public bool AllowEdit { [MonoTODO] get { @@ -73,6 +82,9 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows new rows to be added.")] + [DefaultValue (true)] public bool AllowNew { [MonoTODO] get { @@ -85,6 +97,10 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates whether to use the default sort if the Sort property is not set.")] + [DefaultValue (false)] + [RefreshProperties (RefreshProperties.All)] public bool ApplyDefaultSort { [MonoTODO] get { @@ -99,6 +115,8 @@ namespace System.Data { // get the count of rows in the DataView after RowFilter // and RowStateFilter have been applied + [Browsable (false)] + [DataSysDescription ("Returns the number of items currently in this view.")] public int Count { [MonoTODO] get { @@ -108,6 +126,8 @@ namespace System.Data { } } + [Browsable (false)] + [DataSysDescription ("This returns a pointer to back to the DataViewManager that owns this DataSet (if any).")] public DataViewManager DataViewManager { [MonoTODO] get { @@ -123,6 +143,9 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates an expression used to filter the data returned by this DataView.")] + [DefaultValue ("")] public virtual string RowFilter { [MonoTODO] get { @@ -135,6 +158,9 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the versions of data returned by this DataView.")] + [DefaultValue (DataViewRowState.CurrentRows)] public DataViewRowState RowStateFilter { [MonoTODO] get { @@ -147,6 +173,9 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the order in which data is returned by this DataView.")] + [DefaultValue ("")] public string Sort { [MonoTODO] get { @@ -159,6 +188,10 @@ namespace System.Data { } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the table this DataView uses to get data.")] + [DefaultValue (null)] + [RefreshProperties (RefreshProperties.All)] public DataTable Table { [MonoTODO] get { @@ -231,6 +264,8 @@ namespace System.Data { } [MonoTODO] + [DataCategory ("Data")] + [DataSysDescription ("Indicates the data returned by this DataView has somehow changed.")] public event ListChangedEventHandler ListChanged; protected bool IsOpen { diff --git a/mcs/class/System.Data/System.Data/DataViewManager.cs b/mcs/class/System.Data/System.Data/DataViewManager.cs index 52914ab8df4..f7bcd5b9eff 100644 --- a/mcs/class/System.Data/System.Data/DataViewManager.cs +++ b/mcs/class/System.Data/System.Data/DataViewManager.cs @@ -3,10 +3,13 @@ // // Author: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc. 2002 +// Copyright (C) Tim Coleman, 2002 // +using System; using System.Collections; using System.ComponentModel; @@ -15,62 +18,259 @@ namespace System.Data /// <summary> /// Contains a default DataViewSettingCollection for each DataTable in a DataSet. /// </summary> - public class DataViewManager : MarshalByValueComponent - //, IBindingList, ICollection, IList, ITypedList, IEnumerable + public class DataViewManager : MarshalByValueComponent, IBindingList, ICollection, IList, ITypedList, IEnumerable { - private DataSet dataSet; + #region Fields - public DataViewManager () { + DataSet dataSet; + + #endregion // Fields + + #region Constructors + + public DataViewManager () + { dataSet = null; } - public DataViewManager (DataSet ds) { + public DataViewManager (DataSet ds) + { dataSet = ds; } + #endregion // Constructors + + #region Properties + + [DataSysDescription ("Indicates the source of data for this DataViewManager.")] + [DefaultValue (null)] + public DataSet DataSet { + get { return dataSet; } + set { dataSet = value; } + } + [MonoTODO] - public DataView CreateDataView (DataTable table) { - return new DataView (table); + [DataSysDescription ("Indicates the sorting/filtering/state settings for any table in the corresponding DataSet.")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] + public string DataViewSettingCollectionString { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } } - protected virtual void OnListChanged (ListChangedEventArgs e) { + [MonoTODO] + public DataViewSettingCollection DataViewSettings { + get { throw new NotImplementedException (); } } - protected virtual void RelationCollectionChanged ( - object sender, - CollectionChangeEventArgs e) { + int ICollection.Count { + [MonoTODO] + get { throw new NotImplementedException (); } } - protected virtual void TableCollectionChanged (object sender, - CollectionChangeEventArgs e) { + bool ICollection.IsSynchronized { + [MonoTODO] + get { throw new NotImplementedException (); } } - public DataSet DataSet { - get { - return dataSet; - } - set { - dataSet = value; - } + object ICollection.SyncRoot { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IList.IsFixedSize { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IList.IsReadOnly { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + object IList.this [int index] { + [MonoTODO] + get { throw new NotImplementedException (); } + [MonoTODO] + set { throw new NotImplementedException (); } + } + + bool IBindingList.AllowEdit { + [MonoTODO] + get { throw new NotImplementedException (); } } + bool IBindingList.AllowNew { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IBindingList.AllowRemove { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IBindingList.IsSorted { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + ListSortDirection IBindingList.SortDirection { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + PropertyDescriptor IBindingList.SortProperty { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IBindingList.SupportsChangeNotification { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IBindingList.SupportsSearching { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + bool IBindingList.SupportsSorting { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + #endregion // Properties + + #region Methods + [MonoTODO] - public string DataViewSettingCollectionString { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } + public DataView CreateDataView (DataTable table) + { + return new DataView (table); } [MonoTODO] - public DataViewSettingCollection DataViewSettings { - get { - throw new NotImplementedException (); - } + void IBindingList.AddIndex (PropertyDescriptor property) + { + throw new NotImplementedException (); + } + + [MonoTODO] + object IBindingList.AddNew () + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction) + { + throw new NotImplementedException (); + } + + [MonoTODO] + int IBindingList.Find (PropertyDescriptor property, object key) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IBindingList.RemoveIndex (PropertyDescriptor property) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IBindingList.RemoveSort () + { + throw new NotImplementedException (); + } + + [MonoTODO] + void ICollection.CopyTo (Array array, int index) + { + throw new NotImplementedException (); + } + + [MonoTODO] + IEnumerator IEnumerable.GetEnumerator () + { + throw new NotImplementedException (); + } + + [MonoTODO] + int IList.Add (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IList.Clear () + { + throw new NotImplementedException (); + } + + [MonoTODO] + bool IList.Contains (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + int IList.IndexOf (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IList.Insert (int index, object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IList.Remove (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + void IList.RemoveAt (int index) + { + throw new NotImplementedException (); + } + + [MonoTODO] + PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors) + { + throw new NotImplementedException (); + } + + [MonoTODO] + string ITypedList.GetListName (PropertyDescriptor[] listAccessors) + { + throw new NotImplementedException (); + } + + protected virtual void OnListChanged (ListChangedEventArgs e) + { + if (ListChanged != null) + ListChanged (this, e); + } + + protected virtual void RelationCollectionChanged (object sender, CollectionChangeEventArgs e) + { } + protected virtual void TableCollectionChanged (object sender, CollectionChangeEventArgs e) + { + } + + #endregion // Methods + + #region Events + public event ListChangedEventHandler ListChanged; + + #endregion // Events } } diff --git a/mcs/class/System.Data/System.Data/DataViewSetting.cs b/mcs/class/System.Data/System.Data/DataViewSetting.cs index 4db37d934fc..af728abfcf8 100644 --- a/mcs/class/System.Data/System.Data/DataViewSetting.cs +++ b/mcs/class/System.Data/System.Data/DataViewSetting.cs @@ -1,72 +1,75 @@ // // System.Data.DataViewSetting // -// Author: +// Authors: // Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc. 2002 +// Copyright (C) Tim Coleman, 2002 // +using System.ComponentModel; + namespace System.Data { /// <summary> /// Represents the default settings for ApplyDefaultSort, DataViewManager, RowFilter, RowStateFilter, Sort, and Table for DataViews created from the DataViewManager. /// </summary> + [Serializable] public class DataViewSetting { - private bool defaultSort; - private DataViewManager viewManager; - private string rowFilter; - private DataViewRowState rowStateFilter; - private string sortString; + #region Fields + + bool defaultSort; + DataViewManager viewManager; + string rowFilter; + DataViewRowState rowStateFilter; + string sortString; + + #endregion // Fields + + #region Constructors + + internal DataViewSetting () + { + } + + #endregion // Constructors + + #region Properties public bool ApplyDefaultSort { - get { - return defaultSort; - } - set { - defaultSort = value; - } + get { return defaultSort; } + set { defaultSort = value; } } + [Browsable (false)] public DataViewManager DataViewManager { - get { - return viewManager; - } + get { return viewManager; } } public string RowFilter { - get { - return rowFilter; - } - set { - rowFilter = value; - } + get { return rowFilter; } + set { rowFilter = value; } } public DataViewRowState RowStateFilter { - get { - return rowStateFilter; - } - set { - rowStateFilter = value; - } + get { return rowStateFilter; } + set { rowStateFilter = value; } } public string Sort { - get { - return sortString; - } - set { - sortString = value; - } + get { return sortString; } + set { sortString = value; } } [MonoTODO] + [Browsable (false)] public DataTable Table { - get { - throw new NotImplementedException (); - } + get { throw new NotImplementedException (); } } + + #endregion // Properties } } diff --git a/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs b/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs index c2528878a39..4634ee7de1b 100755 --- a/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs +++ b/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs @@ -1,47 +1,55 @@ // // System.Data.DataViewSettingCollection.cs // -// (C) 2002 Ximian, Inc. http://www.ximian.com -// // Authors: // Rodrigo Moya (rodrigo@ximian.com) // Miguel de Icaza (miguel@gnome.org) +// Tim Coleman (tim@timcoleman.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) Tim Coleman, 2002 // using System; using System.Collections; +using System.ComponentModel; namespace System.Data { /// <summary> /// Contains a read-only collection of DataViewSetting objects for each DataTable in a DataSet. /// </summary> - public class DataViewSettingCollection : ICollection, IEnumerable { - private ArrayList settingList; + [Serializable] + public class DataViewSettingCollection : ICollection, IEnumerable + { + #region Fields - public void CopyTo (Array ar, int index) { - settingList.CopyTo (ar, index); - } + ArrayList settingList; - public IEnumerator GetEnumerator () { - return settingList.GetEnumerator (); + #endregion // Fields + + #region Constructors + + internal DataViewSettingCollection (DataViewManager manager) + { } - + + #endregion // Constructors + + #region Properties + + [Browsable (false)] public virtual int Count { - get { - return settingList.Count; - } + get { return settingList.Count; } } + [Browsable (false)] public bool IsReadOnly { - get { - return settingList.IsReadOnly; - } + get { return settingList.IsReadOnly; } } + [Browsable (false)] public bool IsSynchronized { - get { - return settingList.IsSynchronized; - } + get { return settingList.IsSynchronized; } } public virtual DataViewSetting this [DataTable dt] { @@ -70,18 +78,29 @@ namespace System.Data { } public virtual DataViewSetting this[int index] { - get { - return (DataViewSetting) settingList[index]; - } - set { - settingList[index] = value; - } + get { return (DataViewSetting) settingList[index]; } + set { settingList[index] = value; } } + [Browsable (false)] public object SyncRoot { - get { - return settingList.SyncRoot; - } + get { return settingList.SyncRoot; } + } + + #endregion // Properties + + #region Methods + + public void CopyTo (Array ar, int index) + { + settingList.CopyTo (ar, index); } + + public IEnumerator GetEnumerator () + { + return settingList.GetEnumerator (); + } + + #endregion // Methods } } diff --git a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs index 0d99615c079..55d48213776 100644 --- a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs +++ b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs @@ -14,12 +14,11 @@ using System.Collections; using System.ComponentModel; using System.Runtime.InteropServices; -namespace System.Data -{ - +namespace System.Data { + [DefaultProperty ("ConstraintName")] [Serializable] - public class ForeignKeyConstraint : Constraint { - + public class ForeignKeyConstraint : Constraint + { private UniqueConstraint _parentUniqueConstraint; private DataColumn [] _parentColumns; private DataColumn [] _childColumns; @@ -45,8 +44,7 @@ namespace System.Data _foreignKeyConstraint(null, parentColumns, childColumns); } - public ForeignKeyConstraint(string constraintName, - DataColumn parentColumn, DataColumn childColumn) + public ForeignKeyConstraint(string constraintName, DataColumn parentColumn, DataColumn childColumn) { if (null == parentColumn || null == childColumn) { throw new ArgumentNullException("Neither parentColumn or" + @@ -57,22 +55,18 @@ namespace System.Data new DataColumn[] {childColumn}); } - public ForeignKeyConstraint(string constraintName, - DataColumn[] parentColumns, DataColumn[] childColumns) + public ForeignKeyConstraint(string constraintName, DataColumn[] parentColumns, DataColumn[] childColumns) { _foreignKeyConstraint(constraintName, parentColumns, childColumns); } //special case [MonoTODO] - public ForeignKeyConstraint(string constraintName, - string parentTableName, string[] parentColumnNames, - string[] childColumnNames, - AcceptRejectRule acceptRejectRule, Rule deleteRule, - Rule updateRule) { + [Browsable (false)] + public ForeignKeyConstraint(string constraintName, string parentTableName, string[] parentColumnNames, string[] childColumnNames, AcceptRejectRule acceptRejectRule, Rule deleteRule, Rule updateRule) + { } - private void _foreignKeyConstraint(string constraintName, DataColumn[] parentColumns, DataColumn[] childColumns) { @@ -211,51 +205,49 @@ namespace System.Data #endregion //Helpers + #region Properties - #region Properites - + [DataCategory ("Data")] + [DataSysDescription ("For accept and reject changes, indicates what kind of cascading should take place across this relation.")] + [DefaultValue (AcceptRejectRule.None)] public virtual AcceptRejectRule AcceptRejectRule { - get { - return _acceptRejectRule; - } - - set { - _acceptRejectRule = value; - } + get { return _acceptRejectRule; } + set { _acceptRejectRule = value; } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the child columns of this constraint.")] + [ReadOnly (true)] + public virtual DataColumn[] Columns { + get { return _childColumns; } + } + + [DataCategory ("Data")] + [DataSysDescription ("For deletions, indicates what kind of cascading should take place across this relation.")] + [DefaultValue (Rule.Cascade)] public virtual Rule DeleteRule { - get { - return _deleteRule; - } - - set { - _deleteRule = value; - } + get { return _deleteRule; } + set { _deleteRule = value; } } + [DataCategory ("Data")] + [DataSysDescription ("For updates, indicates what kind of cascading should take place across this relation.")] + [DefaultValue (Rule.Cascade)] public virtual Rule UpdateRule { - get { - return _updateRule; - } - - set { - _updateRule = value; - } - } - - public virtual DataColumn[] Columns { - get { - return _childColumns; - } + get { return _updateRule; } + set { _updateRule = value; } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the parent columns of this constraint.")] + [ReadOnly (true)] public virtual DataColumn[] RelatedColumns { - get { - return _parentColumns; - } + get { return _parentColumns; } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the child table of this constraint.")] + [ReadOnly (true)] public virtual DataTable RelatedTable { get { if (_parentColumns != null) @@ -266,6 +258,9 @@ namespace System.Data } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the table of this constraint.")] + [ReadOnly (true)] public override DataTable Table { get { if (_childColumns != null) @@ -276,8 +271,6 @@ namespace System.Data } } - - #endregion // Properties #region Methods diff --git a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs index ee093a30414..9d0a3031de2 100644 --- a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs +++ b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs @@ -54,6 +54,7 @@ namespace System.Data /// <summary> /// Gets the total number of elements in a collection. /// </summary> + [Browsable (false)] public virtual int Count { get { return list.Count; } } @@ -61,6 +62,7 @@ namespace System.Data /// <summary> /// Gets a value indicating whether the InternalDataCollectionBase is read-only. /// </summary> + [Browsable (false)] public bool IsReadOnly { get { return readOnly; } } @@ -68,6 +70,7 @@ namespace System.Data /// <summary> /// Gets a value indicating whether the InternalDataCollectionBase is synchronized. /// </summary> + [Browsable (false)] public bool IsSynchronized { get { return synchronized; } } @@ -75,13 +78,14 @@ namespace System.Data /// <summary> /// Gets the items of the collection as a list. /// </summary> - protected internal virtual ArrayList List { + protected virtual ArrayList List { get { return list; } } /// <summary> /// Gets an object that can be used to synchronize the collection. /// </summary> + [Browsable (false)] public object SyncRoot { [MonoTODO] get { diff --git a/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs b/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs index 9e58aa76928..e34f1da6a35 100644 --- a/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs +++ b/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs @@ -3,19 +3,25 @@ // // Author: // Miguel de Icaza <miguel@ximian.com> +// Tim Coleman (tim@timcoleman.com) // // (C) Ximian, Inc 2002 +// Copyright (C) Tim Coleman, 2002 // using System; -namespace System.Data -{ - public class MergeFailedEventArgs : EventArgs { +namespace System.Data { + public class MergeFailedEventArgs : EventArgs + { + #region Fields + DataTable data_table; string conflict; - Exception errors; - bool f_continue; + + #endregion // Fields + + #region Constructors public MergeFailedEventArgs (DataTable dataTable, string conflict) { @@ -23,16 +29,18 @@ namespace System.Data this.conflict = conflict; } - public DataTable DataTable { - get { - return data_table; - } + #endregion // Constructors + + #region Properties + + public DataTable Table { + get { return data_table; } } public string Conflict { - get { - return conflict; - } + get { return conflict; } } + + #endregion // Properties } } diff --git a/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs b/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs new file mode 100644 index 00000000000..a7a6674f1c2 --- /dev/null +++ b/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs @@ -0,0 +1,41 @@ +// +// System.Data/ResDescriptionAttribute.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; +using System.ComponentModel; + +namespace System.Data { + [AttributeUsage (AttributeTargets.All)] + internal sealed class ResDescriptionAttribute : DescriptionAttribute + { + #region Fields + + string description; + + #endregion // Fields + + #region Constructors + + public ResDescriptionAttribute (string description) + : base (description) + { + this.description = description; + } + + #endregion // Constructors + + #region Properties + + public override string Description { + get { return description; } + } + + #endregion // Properties + } +} diff --git a/mcs/class/System.Data/System.Data/StrongTypingException.cs b/mcs/class/System.Data/System.Data/StrongTypingException.cs index 65749b68ac8..ce6322935df 100644 --- a/mcs/class/System.Data/System.Data/StrongTypingException.cs +++ b/mcs/class/System.Data/System.Data/StrongTypingException.cs @@ -10,7 +10,6 @@ using System.Globalization; using System.Runtime.Serialization; namespace System.Data { - [Serializable] public class StrongTypingException : DataException { @@ -19,8 +18,8 @@ namespace System.Data { { } - public StrongTypingException (string message) - : base (message) + public StrongTypingException (string message, Exception innerException) + : base (message, innerException) { } diff --git a/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs b/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs index b46e17c385a..d3ad34c860a 100644 --- a/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs +++ b/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs @@ -6,6 +6,7 @@ // (C) Ximian, Inc. using System; +using System.Collections; using System.Globalization; using System.Runtime.Serialization; @@ -19,8 +20,9 @@ namespace System.Data { { } - public TypedDataSetGeneratorException (string message) - : base (message) + [MonoTODO] + public TypedDataSetGeneratorException (ArrayList list) + : base (Locale.GetText ("There is a name conflict")) { } diff --git a/mcs/class/System.Data/System.Data/UniqueConstraint.cs b/mcs/class/System.Data/System.Data/UniqueConstraint.cs index 92d0c272821..f75e8a2aedc 100644 --- a/mcs/class/System.Data/System.Data/UniqueConstraint.cs +++ b/mcs/class/System.Data/System.Data/UniqueConstraint.cs @@ -4,17 +4,19 @@ // Author: // Franklin Wise <gracenote@earthlink.net> // Daniel Morgan <danmorg@sc.rr.com> +// Tim Coleman (tim@timcoleman.com) // // (C) 2002 Franklin Wise // (C) 2002 Daniel Morgan +// Copyright (C) Tim Coleman, 2002 using System; using System.Collections; using System.ComponentModel; using System.Runtime.InteropServices; -namespace System.Data -{ +namespace System.Data { + [DefaultProperty ("ConstraintName")] public class UniqueConstraint : Constraint { private bool _isPrimaryKey = false; @@ -28,54 +30,51 @@ namespace System.Data #region Constructors - public UniqueConstraint(DataColumn column) { - + public UniqueConstraint (DataColumn column) + { _uniqueConstraint ("", column, false); } - public UniqueConstraint(DataColumn[] columns) { - + public UniqueConstraint (DataColumn[] columns) + { _uniqueConstraint ("", columns, false); } - public UniqueConstraint(DataColumn column, - bool isPrimaryKey) { - + public UniqueConstraint (DataColumn column, bool isPrimaryKey) + { _uniqueConstraint ("", column, isPrimaryKey); } - public UniqueConstraint(DataColumn[] columns, bool isPrimaryKey) { - + public UniqueConstraint (DataColumn[] columns, bool isPrimaryKey) + { _uniqueConstraint ("", columns, isPrimaryKey); } - public UniqueConstraint(string name, DataColumn column) { - + public UniqueConstraint (string name, DataColumn column) + { _uniqueConstraint (name, column, false); } - public UniqueConstraint(string name, DataColumn[] columns) { - + public UniqueConstraint (string name, DataColumn[] columns) + { _uniqueConstraint (name, columns, false); } - public UniqueConstraint(string name, DataColumn column, - bool isPrimaryKey) { - + public UniqueConstraint (string name, DataColumn column, bool isPrimaryKey) + { _uniqueConstraint (name, column, isPrimaryKey); } - public UniqueConstraint(string name, - DataColumn[] columns, bool isPrimaryKey) { - + public UniqueConstraint (string name, DataColumn[] columns, bool isPrimaryKey) + { _uniqueConstraint (name, columns, isPrimaryKey); } //Special case. Can only be added to the Collection with AddRange [MonoTODO] - public UniqueConstraint(string name, - string[] columnNames, bool isPrimaryKey) { - + [Browsable (false)] + public UniqueConstraint (string name, string[] columnNames, bool isPrimaryKey) + { throw new NotImplementedException(); //need to finish related logic /* base.ConstraintName = name; @@ -91,9 +90,8 @@ namespace System.Data } //helper ctor - private void _uniqueConstraint(string name, - DataColumn column, bool isPrimaryKey) { - + private void _uniqueConstraint(string name, DataColumn column, bool isPrimaryKey) + { //validate _validateColumn (column); @@ -114,8 +112,8 @@ namespace System.Data } //helpter ctor - public void _uniqueConstraint(string name, - DataColumn[] columns, bool isPrimaryKey) { + private void _uniqueConstraint(string name, DataColumn[] columns, bool isPrimaryKey) + { //validate _validateColumns (columns, out _dataTable); @@ -249,28 +247,29 @@ namespace System.Data return null; } - - #endregion //Helpers #region Properties + [DataCategory ("Data")] + [DataSysDescription ("Indicates the columns of this constraint.")] + [ReadOnly (true)] public virtual DataColumn[] Columns { - get { - return _dataColumns; - } + get { return _dataColumns; } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates if this constraint is a primary key.")] + [ReadOnly (true)] public bool IsPrimaryKey { - get { - return _isPrimaryKey; - } + get { return _isPrimaryKey; } } + [DataCategory ("Data")] + [DataSysDescription ("Indicates the table of this constraint.")] + [ReadOnly (true)] public override DataTable Table { - get { - return _dataTable; - } + get { return _dataTable; } } #endregion // Properties @@ -361,33 +360,25 @@ namespace System.Data //validate no duplicates exists. //Only validate when there are at least 2 rows //so that a duplicate migth exist. - if(tbl.Rows.Count > 1) - { - - + if(tbl.Rows.Count > 1) { //get copy of rows collection first so that we do not modify the //original. - ArrayList clonedDataList = (ArrayList)tbl.Rows.List.Clone(); + DataRow[] rows = new DataRow [tbl.Rows.Count]; + tbl.Rows.CopyTo (rows, 0); + ArrayList clonedDataList = new ArrayList (rows); ArrayList newDataList = new ArrayList(); //copy to array list only the column we are interested in. foreach (DataRow row in clonedDataList) - { - newDataList.Add(row[this._dataColumns[0]]); - } + newDataList.Add (row[this._dataColumns[0]]); //sort ArrayList and check adjacent values for duplicates. - newDataList.Sort(); + newDataList.Sort (); - for( int i = 0 ; i < newDataList.Count - 1 ; i++) - { - if( newDataList[i].Equals(newDataList[i+1]) ) - { - string msg = "Column '" + this._dataColumns[0] + "' contains non-unique values"; - throw new InvalidConstraintException( msg ); - } - } + for (int i = 0 ; i < newDataList.Count - 1 ; i++) + if (newDataList[i].Equals (newDataList[i+1])) + throw new InvalidConstraintException (String.Format ("Column '{0}' contains non-unique values", this._dataColumns[0])); } diff --git a/mcs/class/System.Data/list b/mcs/class/System.Data/list index 769cd11713a..8bf32aa4fc3 100755 --- a/mcs/class/System.Data/list +++ b/mcs/class/System.Data/list @@ -71,6 +71,7 @@ System.Data/ParameterDirection.cs System.Data/PropertyAttributes.cs System.Data/PropertyCollection.cs System.Data/ReadOnlyException.cs +System.Data/ResDescriptionAttribute.cs System.Data/RowNotInTableException.cs System.Data/Rule.cs System.Data/SchemaType.cs |