Author: anagappan
Date: 2006-11-28 08:23:34 -0500 (Tue, 28 Nov 2006)
New Revision: 68580

Modified:
   trunk/mcs/class/System.Data/System.Data/ChangeLog
   trunk/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs
   trunk/mcs/class/System.Data/System.Data/DataRelationCollection.cs
   trunk/mcs/class/System.Data/System.Data/DataRowView.cs
   trunk/mcs/class/System.Data/System.Data/DataSet.cs
   trunk/mcs/class/System.Data/System.Data/DataTable.cs
   trunk/mcs/class/System.Data/System.Data/DataView.cs
   trunk/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs
   trunk/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
   trunk/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs
   trunk/mcs/class/System.Data/System.Data/XmlDataLoader.cs
   trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs
   trunk/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs
Log:
2006-11-28  Nagappan A  <[EMAIL PROTECTED]>

        * XmlSchemaDataImporter.cs: Fixed 2.0 profile compilation
        warnings. Using AttributeSchemaType instead of AttributeType and
        ElementSchemaType instead of ElementType.

        * TypedDataSetGenerator.cs: Modified the profile check from
        !NET_1_1 to !NET_1_0, as this class is obsolete from 1.1 profile.

        * DataRelationCollection.cs (Item): Modified the property Item as
        abstract and implemented it in DataSetRelationCollection and
        DataTableRelationCollection classes.

        * DataRowView.cs: Remove bogus MonoTODOs.

        * ForeignKeyConstraint.cs (ForeignKeyConstraint): Implemented
        2.0 profile's missing constructor.

        * XmlDataLoader.cs (StringToObject): Modify XmlConvert.ToDateTime
        to use XmlDateTimeSerializationMode, as the default ToDataTime
        method id obsolete.

        * XmlDataReader.cs (StringToObject): Modify XmlConvert.ToDateTime
        to use XmlDateTimeSerializationMode, as the default ToDataTime
        method id obsolete.

        * DataView.cs (IsInitialized): Added browsable attribute. 

        * DataViewSettingCollection.cs (CopyTo): Implemented missing 2.0
        API.



Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-11-28 13:21:58 UTC 
(rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-11-28 13:23:34 UTC 
(rev 68580)
@@ -1,5 +1,34 @@
 2006-11-28  Nagappan A  <[EMAIL PROTECTED]>
 
+       * XmlSchemaDataImporter.cs: Fixed 2.0 profile compilation
+       warnings. Using AttributeSchemaType instead of AttributeType and
+       ElementSchemaType instead of ElementType.
+
+       * TypedDataSetGenerator.cs: Modified the profile check from
+       !NET_1_1 to !NET_1_0, as this class is obsolete from 1.1 profile.
+
+       * DataRelationCollection.cs (Item): Modified the property Item as
+       abstract and implemented it in DataSetRelationCollection and
+       DataTableRelationCollection classes.
+
+       * DataRowView.cs: Remove bogus MonoTODOs.
+
+       * ForeignKeyConstraint.cs (ForeignKeyConstraint): Implemented
+       2.0 profile's missing constructor.
+
+       * XmlDataLoader.cs (StringToObject): Modify XmlConvert.ToDateTime
+       to use XmlDateTimeSerializationMode, as the default ToDataTime
+       method id obsolete.
+
+       * XmlDataReader.cs (StringToObject): Modify XmlConvert.ToDateTime
+       to use XmlDateTimeSerializationMode, as the default ToDataTime
+       method id obsolete.
+
+       * DataView.cs (IsInitialized): Added browsable attribute. 
+
+       * DataViewSettingCollection.cs (CopyTo): Implemented missing 2.0
+       API.
+
        * DataRelation.cs (DataRelation): Added 2.0 profile constructor to
        take parentTableNameSpace and childTableNameSpace as argument.
        (FinishInit): Update parentTableNameSpace and childTableNameSpace,
@@ -17,9 +46,14 @@
        (WriteXmlSchema): Throw InvalidOperationException, when table name
        is empty. When DataSet Namespace is set, append that with '_x003A_'
        and table name.
+       (IsInitialized): Added browsable attribute.
 
        * DataSet.cs (Load): Throw ArgumentNullException, when reader
        argument is null.
+       (IsInitialized): Added browsable attribute.
+       (WriteObjectXml): Modify XmlConvert.ToDateTime to use
+       XmlDateTimeSerializationMode, as the default ToDataTime method id
+       obsolete.
 
        * XmlSchemaWriter.cs (WriteSchema): Modified UseCurrentCulture to
        UseCurrentLocale.

Modified: 
trunk/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs     
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs     
2006-11-28 13:23:34 UTC (rev 68580)
@@ -42,7 +42,7 @@
                private bool readOnly = true;
                private Type componentType = null;
                private Type propertyType = null;
-               private PropertyInfo prop = null;
+               //private PropertyInfo prop = null;
                private int columnIndex = 0;
 
                public DataColumnPropertyDescriptor (string name, int 
columnIndex, Attribute [] attrs)

Modified: trunk/mcs/class/System.Data/System.Data/DataRelationCollection.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataRelationCollection.cs   
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataRelationCollection.cs   
2006-11-28 13:23:34 UTC (rev 68580)
@@ -137,6 +137,25 @@
                                        return base.List;
                                }
                        }
+
+                       public override DataRelation this [string name] {
+                               get {
+                                       int index = IndexOf (name, true);
+                                       return index < 0 ? null : 
(DataRelation) List[index];
+                               }
+                       }
+
+                       /// <summary>
+                       /// Gets the DataRelation object at the specified index.
+                       /// </summary>
+                       public override DataRelation this [int index] {
+                               get {
+                                       if (index < 0 || index >= List.Count)
+                                               throw new 
IndexOutOfRangeException (String.Format ("Cannot find relation {0}.", index));
+
+                                       return (DataRelation)List [index];
+                               }
+                       }
                }
 
                /// <summary>
@@ -159,25 +178,43 @@
                                return dataTable.DataSet;
                        }
 
+                       public override DataRelation this [string name] {
+                               get {
+                                       int index = IndexOf (name, true);
+                                       return index < 0 ? null : 
(DataRelation) List[index];
+                               }
+                       }
+
                        /// <summary>
+                       /// Gets the DataRelation object at the specified index.
+                       /// </summary>
+                       public override DataRelation this [int index] {
+                               get {
+                                       if (index < 0 || index >= List.Count)
+                                               throw new 
IndexOutOfRangeException (String.Format ("Cannot find relation {0}.", index));
+
+                                       return (DataRelation)List [index];
+                               }
+                       }
+
+                       /// <summary>
                        /// Performs verification on the table.
                        /// </summary>
                        /// <param name="relation">The relation to 
check.</param>
                        protected override void AddCore (DataRelation relation)
                        {
-                if (dataTable.ParentRelations == this && relation.ChildTable 
!= dataTable)
-                    throw new ArgumentException ("Cannot add a relation to 
this table's " +
-                                                                               
                        "ParentRelations where this table is not" +
-                                                                               
                        " the Child table.");
+                               if (dataTable.ParentRelations == this && 
relation.ChildTable != dataTable)
+                                       throw new ArgumentException ("Cannot 
add a relation to this table's " +
+                                                                    
"ParentRelations where this table is not" +
+                                                                    " the 
Child table.");
 
-                if (dataTable.ChildRelations == this && relation.ParentTable 
!= dataTable)   
-                    throw new ArgumentException("Cannot add a relation to this 
table's " +
-                                                "ChildRelations where this 
table is not" +
-                                                " the Parent table.");
+                               if (dataTable.ChildRelations == this && 
relation.ParentTable != dataTable)   
+                                       throw new ArgumentException("Cannot add 
a relation to this table's " +
+                                                                   
"ChildRelations where this table is not" +
+                                                                   " the 
Parent table.");
                 
                                dataTable.DataSet.Relations.Add(relation);
-                base.AddCore (relation);
-
+                               base.AddCore (relation);
                        }
                         
                        protected override void RemoveCore (DataRelation 
relation)
@@ -211,23 +248,15 @@
                /// <summary>
                /// Gets the DataRelation object specified by name.
                /// </summary>
-               public DataRelation this [string name] {
-                       get {
-                               int index = IndexOf (name, true);
-                               return index < 0 ? null : (DataRelation) 
List[index];
-                       }
+               public abstract DataRelation this [string name] {
+                       get;
                }
 
                /// <summary>
                /// Gets the DataRelation object at the specified index.
                /// </summary>
-               public DataRelation this [int index] {
-                       get {
-                               if (index < 0 || index >= List.Count)
-                                       throw new IndexOutOfRangeException 
(String.Format ("Cannot find relation {0}.", index));
-
-                               return (DataRelation)List [index];
-                       }
+               public abstract DataRelation this [int index] {
+                       get;
                }
 
                

Modified: trunk/mcs/class/System.Data/System.Data/DataRowView.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataRowView.cs      2006-11-28 
13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataRowView.cs      2006-11-28 
13:23:34 UTC (rev 68580)
@@ -144,7 +144,6 @@
                // "Detached", and when this.EndEdit() is invoked, the row
                // will be added to the table.
                public bool IsNew {
-                       [MonoTODO]
                        get {
                                return Row == DataView._lastAdded;
                        }
@@ -215,14 +214,12 @@
                }
 
                public DataRow Row {
-                       [MonoTODO]
                        get {
                                return _dataRow;
                        }
                }
 
                public DataRowVersion RowVersion {
-                       [MonoTODO]
                        get {
                                DataRowVersion version = 
DataView.GetRowVersion(_index);
                                if (version != DataRowVersion.Original)
@@ -232,7 +229,6 @@
                        }
                }
 
-               [MonoTODO]
                public override int GetHashCode() {
                        return _dataRow.GetHashCode();
                }       
@@ -245,7 +241,6 @@
                
                #region ICustomTypeDescriptor implementations
                
-               [MonoTODO]
                AttributeCollection ICustomTypeDescriptor.GetAttributes  ()
                {
                        System.ComponentModel.AttributeCollection attributes;

Modified: trunk/mcs/class/System.Data/System.Data/DataSet.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataSet.cs  2006-11-28 13:21:58 UTC 
(rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataSet.cs  2006-11-28 13:23:34 UTC 
(rev 68580)
@@ -203,7 +203,6 @@
                [DataSysDescription ("Indicates that the DataSet has errors.")]
 #endif
                public bool HasErrors {
-                       [MonoTODO]
                        get {
                                for (int i = 0; i < Tables.Count; i++) {
                                        if (Tables[i].HasErrors)
@@ -214,6 +213,7 @@
                }
 
 #if NET_2_0
+               [Browsable (false)]
                public bool IsInitialized {
                        get { return dataSetInitialized;}
                }
@@ -750,7 +750,8 @@
                        }
                }
 
-               public void Load (IDataReader reader, LoadOption loadOption, 
FillErrorEventHandler errorHandler, params DataTable[] tables)
+               public virtual void Load (IDataReader reader, LoadOption 
loadOption,
+                                         FillErrorEventHandler errorHandler, 
params DataTable[] tables)
                {
                        if (reader == null) {
                                throw new ArgumentNullException ("Value cannot 
be null. Parameter name: reader");
@@ -1581,7 +1582,11 @@
                                case TypeCode.Char:
                                        return XmlConvert.ToString ((Char) o);
                                case TypeCode.DateTime:
+#if NET_2_0
+                                       return XmlConvert.ToString ((DateTime) 
o, XmlDateTimeSerializationMode.Unspecified);
+#else
                                        return XmlConvert.ToString ((DateTime) 
o);
+#endif
                                case TypeCode.Decimal:
                                        return XmlConvert.ToString ((Decimal) 
o);
                                case TypeCode.Double:

Modified: trunk/mcs/class/System.Data/System.Data/DataTable.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataTable.cs        2006-11-28 
13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataTable.cs        2006-11-28 
13:23:34 UTC (rev 68580)
@@ -852,6 +852,7 @@
                }
 
 #if NET_2_0
+               [Browsable (false)]
                public bool IsInitialized {
                        get { return tableInitialized;}
                }

Modified: trunk/mcs/class/System.Data/System.Data/DataView.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataView.cs 2006-11-28 13:21:58 UTC 
(rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataView.cs 2006-11-28 13:23:34 UTC 
(rev 68580)
@@ -36,7 +36,7 @@
        [DefaultProperty ("Table")]
        [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.DataViewDesigner, "+ 
Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
 #if NET_2_0
-       public class DataView : MarshalByValueComponent, IBindingList, IList, 
ICollection, IEnumerable, ITypedList, ISupportInitialize, IBindingListView
+       public class DataView : MarshalByValueComponent, IBindingList, IList, 
ICollection, IEnumerable, ITypedList, ISupportInitialize, IBindingListView, 
ISupportInitializeNotification
 #else
        public class DataView : MarshalByValueComponent, IBindingList, IList, 
ICollection, IEnumerable, ITypedList, ISupportInitialize
 #endif
@@ -68,7 +68,7 @@
                bool allowEdit = true;
                bool allowDelete = true;
                bool applyDefaultSort = false;
-               bool isSorted = false;
+               //bool isSorted = false;
 
                bool isOpen = false;
 
@@ -366,6 +366,7 @@
                }
 
 #if NET_2_0
+               [Browsable (false)]
                public bool IsInitialized {
                        get { return dataViewInitialized;}
                }

Modified: trunk/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs        
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs        
2006-11-28 13:23:34 UTC (rev 68580)
@@ -130,6 +130,13 @@
                        settingList.CopyTo (ar, index);
                }
 
+#if NET_2_0
+               public void CopyTo (DataViewSetting [] ar, int index) 
+               {
+                       settingList.CopyTo (ar, index);
+               }
+#endif
+
                public IEnumerator GetEnumerator () 
                {
                        return settingList.GetEnumerator ();

Modified: trunk/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs     
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs     
2006-11-28 13:23:34 UTC (rev 68580)
@@ -56,6 +56,9 @@
                private Rule _updateRule = Rule.Cascade;
                private AcceptRejectRule _acceptRejectRule = 
AcceptRejectRule.None;
                private string _parentTableName;
+#if NET_2_0
+               private string _parentTableNamespace;
+#endif
                private string _childTableName;
 
                //FIXME: remove those; and use only DataColumns[]
@@ -157,15 +160,36 @@
                        _validateColumns (parentColumns, childColumns);
                        _parentColumns = parentColumns;
                        _childColumns = childColumns;
+#if NET_2_0
+                       parentTable.Namespace = _parentTableNamespace;
+#endif
                        InitInProgress = false;
                }
 
 #if NET_2_0
-               [MonoTODO]
                [Browsable (false)]
                public ForeignKeyConstraint (string constraintName, string 
parentTableName, string parentTableNamespace, string[] parentColumnNames, 
string[] childColumnNames, AcceptRejectRule acceptRejectRule, Rule deleteRule, 
Rule updateRule)
                {
-                       throw new NotImplementedException ();
+                       InitInProgress = true;
+                       base.ConstraintName = constraintName;
+
+                       // "parentTableName" is searched in the "DataSet" to 
which the "DataTable"
+                       // from which AddRange() is called
+                       // childTable is the "DataTable" which calls AddRange()
+
+                       // Keep reference to parentTableName to resolve later
+                       _parentTableName = parentTableName;
+                       _parentTableNamespace = parentTableNamespace;
+
+                       // Keep reference to parentColumnNames to resolve later
+                       _parentColumnNames = parentColumnNames;
+
+                       // Keep reference to childColumnNames to resolve later
+                       _childColumnNames = childColumnNames;
+
+                       _acceptRejectRule = acceptRejectRule;
+                       _deleteRule = deleteRule;
+                       _updateRule = updateRule;
                }
 #endif
 

Modified: trunk/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs    
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs    
2006-11-28 13:23:34 UTC (rev 68580)
@@ -38,7 +38,7 @@
 
 namespace System.Data
 {
-#if !NET_1_1
+#if !NET_1_0
        [Obsolete ("TypedDataSetGenerator class will be removed in a future 
release. Please use System.Data.Design.TypedDataSetGenerator in 
System.Design.dll.")]
 #endif
        public class TypedDataSetGenerator
@@ -47,11 +47,11 @@
                {
                }
 
-               [MonoTODO ("See CustomDataclassGenerator.cs")]
                public static void Generate (DataSet dataSet,
                        CodeNamespace codeNamespace,
                        ICodeGenerator codeGen)
                {
+                       // See CustomDataclassGenerator.cs
                        CustomDataClassGenerator.CreateDataSetClasses (
                                dataSet, codeNamespace, codeGen, null);
                }

Modified: trunk/mcs/class/System.Data/System.Data/XmlDataLoader.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/XmlDataLoader.cs    2006-11-28 
13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/XmlDataLoader.cs    2006-11-28 
13:23:34 UTC (rev 68580)
@@ -208,7 +208,11 @@
                                case TypeCode.Boolean: return 
XmlConvert.ToBoolean (value);
                                case TypeCode.Byte: return XmlConvert.ToByte 
(value);
                                case TypeCode.Char: return 
(char)XmlConvert.ToInt32 (value);
+#if NET_2_0
+                               case TypeCode.DateTime: return 
XmlConvert.ToDateTime (value, XmlDateTimeSerializationMode.Unspecified);
+#else
                                case TypeCode.DateTime: return 
XmlConvert.ToDateTime (value);
+#endif
                                case TypeCode.Decimal: return 
XmlConvert.ToDecimal (value);
                                case TypeCode.Double: return 
XmlConvert.ToDouble (value);
                                case TypeCode.Int16: return XmlConvert.ToInt16 
(value);

Modified: trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs    2006-11-28 
13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/XmlDataReader.cs    2006-11-28 
13:23:34 UTC (rev 68580)
@@ -347,7 +347,11 @@
                                case TypeCode.Boolean: return 
XmlConvert.ToBoolean (value);
                                case TypeCode.Byte: return XmlConvert.ToByte 
(value);
                                case TypeCode.Char: return 
(char)XmlConvert.ToInt32 (value);
+#if NET_2_0
+                               case TypeCode.DateTime: return 
XmlConvert.ToDateTime (value, XmlDateTimeSerializationMode.Unspecified);
+#else
                                case TypeCode.DateTime: return 
XmlConvert.ToDateTime (value);
+#endif
                                case TypeCode.Decimal: return 
XmlConvert.ToDecimal (value);
                                case TypeCode.Double: return 
XmlConvert.ToDouble (value);
                                case TypeCode.Int16: return XmlConvert.ToInt16 
(value);

Modified: trunk/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs    
2006-11-28 13:21:58 UTC (rev 68579)
+++ trunk/mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs    
2006-11-28 13:23:34 UTC (rev 68580)
@@ -290,9 +290,15 @@
                        e.Name = "bar";
                        s.Items.Add (e);
                        s.Compile (null);
+#if NET_2_0
+                       schemaIntegerType = ((XmlSchemaSimpleType) 
a.AttributeSchemaType).Datatype;
+                       schemaDecimalType = ((XmlSchemaSimpleType) 
b.AttributeSchemaType).Datatype;
+                       schemaAnyType = e.ElementSchemaType as 
XmlSchemaComplexType;
+#else
                        schemaIntegerType = a.AttributeType as 
XmlSchemaDatatype;
                        schemaDecimalType = b.AttributeType as 
XmlSchemaDatatype;
                        schemaAnyType = e.ElementType as XmlSchemaComplexType;
+#endif
                }
 
                #region Fields
@@ -343,8 +349,13 @@
                                        if (datasetElement == null &&
                                                IsDataSetElement (el))
                                                datasetElement = el;
+#if NET_2_0
+                                       if (el.ElementSchemaType is 
XmlSchemaComplexType &&
+                                           el.ElementSchemaType != 
schemaAnyType)
+#else
                                        if (el.ElementType is 
XmlSchemaComplexType &&
-el.ElementType != schemaAnyType)
+                                           el.ElementType != schemaAnyType)
+#endif
                                                targetElements.Add (obj);
                                }
                        }
@@ -364,8 +375,13 @@
                        foreach (XmlSchemaObject obj in schema.Items) {
                                if (obj is XmlSchemaElement) {
                                        XmlSchemaElement el = obj as 
XmlSchemaElement;
+#if NET_2_0
+                                       if (el.ElementSchemaType is 
XmlSchemaComplexType &&
+                                           el.ElementSchemaType != 
schemaAnyType)
+#else
                                        if (el.ElementType is 
XmlSchemaComplexType &&
-el.ElementType != schemaAnyType)
+                                           el.ElementType != schemaAnyType)
+#endif
                                                targetElements.Add (obj);
                                }
                        }
@@ -440,7 +456,12 @@
                {
                        XmlSchemaElement el = p as XmlSchemaElement;
                        if (el != null) {
-                               XmlSchemaComplexType ct = el.ElementType as 
XmlSchemaComplexType;
+                               XmlSchemaComplexType ct = null;
+#if NET_2_0
+                               ct = el.ElementSchemaType as 
XmlSchemaComplexType;
+#else
+                               ct = el.ElementType as XmlSchemaComplexType;
+#endif
                                if (ct == null || ct == schemaAnyType)
                                        return true; // column element
                                if (ct.AttributeUses.Count > 0)
@@ -466,7 +487,11 @@
                                return;
 
                        // If type is not complex, just skip this element
+#if NET_2_0
+                       if (! (el.ElementSchemaType is XmlSchemaComplexType && 
el.ElementSchemaType != schemaAnyType))
+#else
                        if (! (el.ElementType is XmlSchemaComplexType && 
el.ElementType != schemaAnyType))
+#endif
                                return;
 
                        if (IsDataSetElement (el)) {
@@ -497,7 +522,12 @@
                        }
 
                        // Process content type particle (and create DataTable)
-                       XmlSchemaComplexType ct = el.ElementType as 
XmlSchemaComplexType;
+                       XmlSchemaComplexType ct = null;
+#if NET_2_0
+                       ct = el.ElementSchemaType as XmlSchemaComplexType;
+#else
+                       ct = el.ElementType as XmlSchemaComplexType;
+#endif
                        XmlSchemaParticle p = ct != null ? 
ct.ContentTypeParticle : null;
                        if (p != null)
                                HandleDataSetContentTypeParticle (p);
@@ -507,7 +537,11 @@
                {
                        XmlSchemaElement el = p as XmlSchemaElement;
                        if (el != null) {
+#if NET_2_0
+                               if (el.ElementSchemaType is 
XmlSchemaComplexType && el.RefName != el.QualifiedName)
+#else
                                if (el.ElementType is XmlSchemaComplexType && 
el.RefName != el.QualifiedName)
+#endif
                                        ProcessDataTableElement (el);
                        }
                        else if (p is XmlSchemaGroupBase) {
@@ -540,7 +574,12 @@
 
                        // Handle complex type (NOTE: It is (or should be)
                        // impossible the type is other than complex type).
-                       XmlSchemaComplexType ct = (XmlSchemaComplexType) 
el.ElementType;
+                       XmlSchemaComplexType ct = null;
+#if NET_2_0
+                       ct = (XmlSchemaComplexType) el.ElementSchemaType;
+#else
+                       ct = (XmlSchemaComplexType) el.ElementType;
+#endif
 
                        // Handle attributes
                        foreach (DictionaryEntry de in ct.AttributeUses)
@@ -654,7 +693,12 @@
                        DataColumn col = new DataColumn ();
                        col.ColumnName = attr.QualifiedName.Name;
                        col.Namespace = attr.QualifiedName.Namespace;
-                       XmlSchemaDatatype dt = GetSchemaPrimitiveType 
(attr.AttributeType);
+                       XmlSchemaDatatype dt = null;
+#if NET_2_0
+                       dt = GetSchemaPrimitiveType (((XmlSchemaSimpleType) 
attr.AttributeSchemaType).Datatype);
+#else
+                       dt = GetSchemaPrimitiveType (attr.AttributeType);
+#endif
                        // This complicated check comes from the fact that
                        // MS.NET fails to map System.Object to anyType (that
                        // will cause ReadTypedObject() fail on 
XmlValidatingReader).
@@ -674,7 +718,11 @@
                        if (attr.Use == XmlSchemaUse.Required)
                                col.AllowDBNull = false;
 
+#if NET_2_0
+                       FillFacet (col, attr.AttributeSchemaType as 
XmlSchemaSimpleType);
+#else
                        FillFacet (col, attr.AttributeType as 
XmlSchemaSimpleType);
+#endif
 
                        // Call this method after filling the name
                        ImportColumnMetaInfo (attr, attr.QualifiedName, col);
@@ -689,7 +737,11 @@
                        col.DefaultValue = GetElementDefaultValue (el);
                        col.AllowDBNull = (el.MinOccurs == 0);
 
+#if NET_2_0
+                       if (el.ElementSchemaType is XmlSchemaComplexType && 
el.ElementSchemaType != schemaAnyType)
+#else
                        if (el.ElementType is XmlSchemaComplexType && 
el.ElementType != schemaAnyType)
+#endif
                                FillDataColumnComplexElement (parent, el, col);
                        else if (el.MaxOccurs != 1)
                                FillDataColumnRepeatedSimpleElement (parent, 
el, col);
@@ -826,7 +878,11 @@
                        cc2.Namespace = el.QualifiedName.Namespace;
                        cc2.ColumnMapping = MappingType.SimpleContent;
                        cc2.AllowDBNull = false;
+#if NET_2_0
+                       cc2.DataType = ConvertDatatype (GetSchemaPrimitiveType 
(el.ElementSchemaType));
+#else
                        cc2.DataType = ConvertDatatype (GetSchemaPrimitiveType 
(el.ElementType));
+#endif
 
                        dt.Columns.Add (cc2);
                        dt.Columns.Add (cc);
@@ -847,8 +903,13 @@
                        col.ColumnName = XmlHelper.Decode 
(el.QualifiedName.Name);
                        col.Namespace = el.QualifiedName.Namespace;
                        col.ColumnMapping = MappingType.Element;
+#if NET_2_0
+                       col.DataType = ConvertDatatype (GetSchemaPrimitiveType 
(el.ElementSchemaType));
+                       FillFacet (col, el.ElementSchemaType as 
XmlSchemaSimpleType);
+#else
                        col.DataType = ConvertDatatype (GetSchemaPrimitiveType 
(el.ElementType));
                        FillFacet (col, el.ElementType as XmlSchemaSimpleType);
+#endif
 
                        ImportColumnMetaInfo (el, el.QualifiedName, col);
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to