2006-11-28 Nagappan A <anagappan@novell.com>
authorNagappan Alagappan <nagappan@gmail.com>
Tue, 28 Nov 2006 13:23:34 +0000 (13:23 -0000)
committerNagappan Alagappan <nagappan@gmail.com>
Tue, 28 Nov 2006 13:23:34 +0000 (13:23 -0000)
* 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.

svn path=/trunk/mcs/; revision=68580

13 files changed:
mcs/class/System.Data/System.Data/ChangeLog
mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs
mcs/class/System.Data/System.Data/DataRelationCollection.cs
mcs/class/System.Data/System.Data/DataRowView.cs
mcs/class/System.Data/System.Data/DataSet.cs
mcs/class/System.Data/System.Data/DataTable.cs
mcs/class/System.Data/System.Data/DataView.cs
mcs/class/System.Data/System.Data/DataViewSettingCollection.cs
mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs
mcs/class/System.Data/System.Data/XmlDataLoader.cs
mcs/class/System.Data/System.Data/XmlDataReader.cs
mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs

index afbbb653f7b2daf4295a72334100b19bfdb64a89..842cc93786771623cbeb12d8b8e7641814e6a021 100644 (file)
@@ -1,5 +1,34 @@
 2006-11-28  Nagappan A  <anagappan@novell.com>
 
+       * 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,
        (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.
index 9501d8ed6ee77c56d099e72593577262081cf337..dc8ae4f9e61dd64ed480df38204958802ec4807f 100644 (file)
@@ -42,7 +42,7 @@ namespace System.Data
                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)
index 52208e2540432c2a30fcaa4603f1d8241cd8150a..a9cc482da4a59c5f1898c655864a66252295c7d7 100644 (file)
@@ -137,6 +137,25 @@ namespace System.Data {
                                        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 @@ namespace System.Data {
                                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.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.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.");
                 
                                dataTable.DataSet.Relations.Add(relation);
-                base.AddCore (relation);
-
+                               base.AddCore (relation);
                        }
                         
                        protected override void RemoveCore (DataRelation relation)
@@ -211,23 +248,15 @@ namespace System.Data {
                /// <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;
                }
 
                
index 1517f66667335acd30a52e3e9a053b28625b4e58..97e2f7b8a8ea273b4fdd8617df370c31b6b76581 100644 (file)
@@ -144,7 +144,6 @@ namespace System.Data
                // "Detached", and when this.EndEdit() is invoked, the row\r
                // will be added to the table.\r
                public bool IsNew {\r
-                       [MonoTODO]\r
                        get {\r
                                return Row == DataView._lastAdded;\r
                        }\r
@@ -215,14 +214,12 @@ namespace System.Data
                }\r
 \r
                public DataRow Row {\r
-                       [MonoTODO]\r
                        get {\r
                                return _dataRow;\r
                        }\r
                }\r
 \r
                public DataRowVersion RowVersion {\r
-                       [MonoTODO]\r
                        get {\r
                                DataRowVersion version = DataView.GetRowVersion(_index);\r
                                if (version != DataRowVersion.Original)\r
@@ -232,7 +229,6 @@ namespace System.Data
                        }\r
                }\r
 \r
-               [MonoTODO]\r
                public override int GetHashCode() {\r
                        return _dataRow.GetHashCode();\r
                }       \r
@@ -245,7 +241,6 @@ namespace System.Data
                \r
                #region ICustomTypeDescriptor implementations\r
                \r
-               [MonoTODO]\r
                AttributeCollection ICustomTypeDescriptor.GetAttributes  ()\r
                {\r
                        System.ComponentModel.AttributeCollection attributes;\r
index 57d531fdf9b6a9870895da8ead854e89fc857d3a..ac1f6a06984209a80190cc0ff2f099c46348f591 100644 (file)
@@ -203,7 +203,6 @@ namespace System.Data {
                [DataSysDescription ("Indicates that the DataSet has errors.")]\r
 #endif\r
                public bool HasErrors {\r
-                       [MonoTODO]\r
                        get {\r
                                for (int i = 0; i < Tables.Count; i++) {\r
                                        if (Tables[i].HasErrors)\r
@@ -214,6 +213,7 @@ namespace System.Data {
                }\r
 \r
 #if NET_2_0\r
+               [Browsable (false)]\r
                public bool IsInitialized {\r
                        get { return dataSetInitialized;}\r
                }\r
@@ -750,7 +750,8 @@ namespace System.Data {
                        }\r
                }\r
 \r
-               public void Load (IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler, params DataTable[] tables)\r
+               public virtual void Load (IDataReader reader, LoadOption loadOption,\r
+                                         FillErrorEventHandler errorHandler, params DataTable[] tables)\r
                {\r
                        if (reader == null) {\r
                                throw new ArgumentNullException ("Value cannot be null. Parameter name: reader");\r
@@ -1581,7 +1582,11 @@ namespace System.Data {
                                case TypeCode.Char:\r
                                        return XmlConvert.ToString ((Char) o);\r
                                case TypeCode.DateTime:\r
+#if NET_2_0\r
+                                       return XmlConvert.ToString ((DateTime) o, XmlDateTimeSerializationMode.Unspecified);\r
+#else\r
                                        return XmlConvert.ToString ((DateTime) o);\r
+#endif\r
                                case TypeCode.Decimal:\r
                                        return XmlConvert.ToString ((Decimal) o);\r
                                case TypeCode.Double:\r
index 623874f0bf6885fd1a06db9f3da6c313b70985f9..b6dd9a2b9777bcf8829fcbd250f3a735d87f0629 100644 (file)
@@ -852,6 +852,7 @@ namespace System.Data {
                }\r
 \r
 #if NET_2_0\r
+               [Browsable (false)]\r
                public bool IsInitialized {\r
                        get { return tableInitialized;}\r
                }\r
index 3fdaa3e4410c301c72c2b6b5a3c1956780ac5fc4..bf113b4e82f43a57821f2d2ddfcbfa1328475236 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Data
        [DefaultProperty ("Table")]\r
        [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.DataViewDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]\r
 #if NET_2_0\r
-       public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize, IBindingListView\r
+       public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize, IBindingListView, ISupportInitializeNotification\r
 #else\r
        public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize\r
 #endif\r
@@ -68,7 +68,7 @@ namespace System.Data
                bool allowEdit = true;\r
                bool allowDelete = true;\r
                bool applyDefaultSort = false;\r
-               bool isSorted = false;\r
+               //bool isSorted = false;\r
 \r
                bool isOpen = false;\r
 \r
@@ -366,6 +366,7 @@ namespace System.Data
                }\r
 \r
 #if NET_2_0\r
+               [Browsable (false)]\r
                public bool IsInitialized {\r
                        get { return dataViewInitialized;}\r
                }\r
index fceb62fad2c6e8eae787255a65d54c2d6fd22815..adb24a9bb3efd2b2b0cd8e7f4c4baa55f0169dae 100644 (file)
@@ -130,6 +130,13 @@ namespace System.Data {
                        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 ();
index a01e55ce5bb487c6079a2eb8b754edae656657c3..215b4e11aaebef477f3d80f239abd7358343ce04 100644 (file)
@@ -56,6 +56,9 @@ namespace System.Data {
                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 @@ namespace System.Data {
                        _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
 
index 1e3958a93bd97fa9e4f3e62aeba925cbfe787026..51d559221954711655070616df91bd45bee9d2d0 100644 (file)
@@ -38,7 +38,7 @@ using System.Text;
 
 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 @@ namespace System.Data
                {
                }
 
-               [MonoTODO ("See CustomDataclassGenerator.cs")]
                public static void Generate (DataSet dataSet,
                        CodeNamespace codeNamespace,
                        ICodeGenerator codeGen)
                {
+                       // See CustomDataclassGenerator.cs
                        CustomDataClassGenerator.CreateDataSetClasses (
                                dataSet, codeNamespace, codeGen, null);
                }
index e364b858c02dbd39f79c1d92517e29b8c59b10d2..d1127b80be60ee64aebe9d4ded0f451670acc432 100644 (file)
@@ -208,7 +208,11 @@ namespace System.Data
                                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);
index 63d0926d523c2211eddfa3da04dcb658a4eaaf74..8cc749699f4ce70ea36fb21da169d8ab2989ae7a 100644 (file)
@@ -347,7 +347,11 @@ namespace System.Data
                                case TypeCode.Boolean: return XmlConvert.ToBoolean (value);\r
                                case TypeCode.Byte: return XmlConvert.ToByte (value);\r
                                case TypeCode.Char: return (char)XmlConvert.ToInt32 (value);\r
+#if NET_2_0\r
+                               case TypeCode.DateTime: return XmlConvert.ToDateTime (value, XmlDateTimeSerializationMode.Unspecified);\r
+#else\r
                                case TypeCode.DateTime: return XmlConvert.ToDateTime (value);\r
+#endif\r
                                case TypeCode.Decimal: return XmlConvert.ToDecimal (value);\r
                                case TypeCode.Double: return XmlConvert.ToDouble (value);\r
                                case TypeCode.Int16: return XmlConvert.ToInt16 (value);\r
index 15bd538b1adc82bc08e4be30625c6be080b6ed5e..79825baa206dc069ddca8e497597a560779fd9f1 100644 (file)
@@ -290,9 +290,15 @@ namespace System.Data
                        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 @@ namespace System.Data
                                        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 @@ el.ElementType != schemaAnyType)
                        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 @@ el.ElementType != schemaAnyType)
                {
                        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 @@ el.ElementType != schemaAnyType)
                                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 @@ el.ElementType != schemaAnyType)
                        }
 
                        // 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 @@ el.ElementType != schemaAnyType)
                {
                        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 @@ el.ElementType != schemaAnyType)
 
                        // 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 @@ el.ElementType != schemaAnyType)
                        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 @@ el.ElementType != schemaAnyType)
                        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 @@ el.ElementType != schemaAnyType)
                        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 @@ el.ElementType != schemaAnyType)
                        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 @@ el.ElementType != schemaAnyType)
                        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);