importing messaging-2008 branch to trunk [continued]
[mono.git] / mcs / class / System.Data / System.Data / DataColumnPropertyDescriptor.cs
old mode 100755 (executable)
new mode 100644 (file)
index 2c85a6f..dc8ae4f
@@ -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)
@@ -51,6 +51,15 @@ namespace System.Data
                        this.columnIndex = columnIndex;
                }
 
+               public DataColumnPropertyDescriptor (DataColumn dc)
+                       : base (dc.ColumnName, null) 
+               {
+                       this.columnIndex = dc.Ordinal;
+                       this.componentType = typeof(DataRowView);
+                       this.propertyType = dc.DataType;
+                       this.readOnly = dc.ReadOnly;
+               }
+
                public void SetReadOnly (bool value) 
                {
                        readOnly = value;
@@ -66,29 +75,6 @@ namespace System.Data
                        propertyType = type;
                }
 
-               private PropertyInfo GetPropertyInfo () 
-               {
-                       string defaultMemberName = "";
-                       object[] attribs = componentType.GetCustomAttributes (true);
-                                               
-                       for (int at = 0; at < attribs.Length; at++) {
-                               if (attribs[at] is DefaultMemberAttribute) {
-                                       defaultMemberName = ((DefaultMemberAttribute) attribs[at]).MemberName;
-                                       break;
-                               }
-                       }
-
-                       // FIXME: what do I do if a DefaultMemeberAttribute is not found?
-                       //        should I try looking for DefaultPropertyAttribute?
-                       if (defaultMemberName.Equals(""))
-                               throw new SystemException("Default property not found.");
-
-                       Type[] parmTypes = new Type[1];
-                       parmTypes[0] = propertyType;
-                       PropertyInfo propertyInfo = componentType.GetProperty (defaultMemberName, parmTypes);
-                       return propertyInfo;
-               }
-
                public override object GetValue (object component) 
                {
                        // FIXME: what is the correct way to Get a Value?