[DefaultProperty ("TableName")]
[DesignTimeVisible (false)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DataTableEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
- [TypeConverterAttribute("System.ComponentModel.ComponentConverter, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
[Serializable]
public class DataTable : MarshalByValueComponent, IListSource, ISupportInitialize, ISerializable
{
/// An enum variable indicating whether BeginInit() or EndInit() is called.
/// Delegate to call a function which performs cleanup after EndInit() is called
/// </summary>
- public enum initStatus { NotInitialized, BeginInit, EndInit };
+ internal enum initStatus { NotInitialized, BeginInit, EndInit };
private initStatus _initStatus;
{
string schema = info.GetString ("XmlSchema");
string data = info.GetString ("XmlDiffGram");
-
+
+ DataSet ds = new DataSet ();
+ ds.ReadXmlSchema (new StringReader (schema));
+ ds.Tables [0].CopyProperties (this);
+ ds = new DataSet ();
+ ds.Tables.Add (this);
+ ds.ReadXml (new StringReader (data), XmlReadMode.IgnoreSchema);
+ ds.Tables.Remove (this);
+/* keeping for a while. With the change above, we shouldn't have to consider
+ * DataTable mode in schema inference/read.
XmlSchemaMapper mapper = new XmlSchemaMapper (this);
XmlTextReader xtr = new XmlTextReader(new StringReader (schema));
mapper.Read (xtr);
XmlDiffLoader loader = new XmlDiffLoader (this);
xtr = new XmlTextReader(new StringReader (data));
loader.Load (xtr);
+*/
}
#if NET_2_0
[DataSysDescription ("The expression used to compute the data-bound value of this row.")]
[DefaultValue ("")]
public string DisplayExpression {
- get { return "" + _displayExpression; }
+ get { return _displayExpression == null ? "" : _displayExpression; }
set { _displayExpression = value; }
}
[DataCategory ("Data")]
[DataSysDescription ("Indicates the XML uri namespace for the elements contained in this table.")]
public string Namespace {
- get { return "" + _nameSpace; }
+ get { return _nameSpace == null ? "" : _nameSpace; }
set { _nameSpace = value; }
}
[DataSysDescription ("Indicates the Prefix of the namespace used for this table in XML representation.")]
[DefaultValue ("")]
public string Prefix {
- get { return "" + _prefix; }
+ get { return _prefix == null ? "" : _prefix; }
set {
// Prefix cannot contain any special characters other than '_' and ':'
for (int i = 0; i < value.Length; i++) {
[DefaultValue ("")]
[RefreshProperties (RefreshProperties.All)]
public string TableName {
- get { return "" + _tableName; }
+ get { return _tableName == null ? "" : _tableName; }
set { _tableName = value; }
}
}
}
- public bool RowsExist(Object[] columns, Object[] relatedColumns,DataRow row)
+ internal bool RowsExist(Object[] columns, Object[] relatedColumns,DataRow row)
{
object[] vals = new object[relatedColumns.Length];
for (int i = 0; i < vals.Length; i++)
return RowsExist(columns,vals);
}
- public bool RowsExist(Object[] columns,Object[] values)
+ internal bool RowsExist(Object[] columns,Object[] values)
{
bool rowsExist = false;
Index indx = this.GetIndexByColumns ((DataColumn[])columns);
if (sortableColumns.Length == 0)
throw new Exception("sort expression result is 0");
- RowSorter rowSorter = new RowSorter (dataRows, sortableColumns);
+ RowSorter rowSorter = new RowSorter (this, dataRows, sortableColumns);
dataRows = rowSorter.SortRows ();
sortableColumns = null;
// {
// RemoveColumn(this, e);
// }
+ this.Rows.onColumnRemoved(column.Ordinal);
}
/// <summary>
string columnName = columnSortInfo[0].Trim ();
string sortOrder = "ASC";
if (columnSortInfo.Length > 1)
- sortOrder = columnSortInfo[1].Trim ().ToUpper ();
+ sortOrder = columnSortInfo[1].Trim ().ToUpper (Locale);
ListSortDirection sortDirection = ListSortDirection.Ascending;
switch (sortOrder) {
private class RowSorter : IComparer
{
+ private DataTable table;
private SortableColumn[] sortColumns;
private DataRow[] rowsToSort;
- internal RowSorter(DataRow[] unsortedRows,
+ internal RowSorter(DataTable table,
+ DataRow[] unsortedRows,
SortableColumn[] sortColumns)
{
+ this.table = table;
this.sortColumns = sortColumns;
this.rowsToSort = unsortedRows;
}
return 1;
if((a is string) && (b is string)) {
- a = ((string) a).ToUpper ();
- b = ((string) b).ToUpper ();
+ a = ((string) a).ToUpper (table.Locale);
+ b = ((string) b).ToUpper (table.Locale);
}
if (a is IComparable)