2005-01-24 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 24 Jan 2005 09:34:53 +0000 (09:34 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 24 Jan 2005 09:34:53 +0000 (09:34 -0000)
* DataColumn.cs : set_MaxLength is not allowed when it is mapped to
  SimpleContent. (However, it is weird but it never fails when we set
  ColumnMapping = MappingType.SimpleContent when we have MaxLength.)

* DataColumnTest.cs : Added SetMaxLength().

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

mcs/class/System.Data/System.Data/ChangeLog
mcs/class/System.Data/System.Data/DataColumn.cs
mcs/class/System.Data/Test/System.Data/ChangeLog
mcs/class/System.Data/Test/System.Data/DataColumnTest.cs

index efb107d2337ae5ff90294b60e77b32eddb275071..bdd8b0832b4321c32f6dbf3e505d790b5b3b1915 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-24  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DataColumn.cs : set_MaxLength is not allowed when it is mapped to
+         SimpleContent. (However, it is weird but it never fails when we set
+         ColumnMapping = MappingType.SimpleContent when we have MaxLength.)
+
 2005-01-21  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DataRow.cs : more Current -> Default fixes. Check if it should throw
index b8e46eb754de61ff9ba13dd288c7fe9a2848f26f..ddba8bf2357bc67e553e39cf5f63d2540fb38cbd 100644 (file)
@@ -474,6 +474,8 @@ namespace System.Data {
                                return maxLength;
                        }
                        set {
+                               if (_columnMapping == MappingType.SimpleContent)
+                                       throw new ArgumentException (String.Format ("Cannot set MaxLength property on '{0}' column which is mapped to SimpleContent.", ColumnName));
                                //only applies to string columns
                                maxLength = value;
                        }
index d2024de8e24d3522bccc89c38dba6f72a7e2c826..ce184718e8c47e0ae212c38250ea40533d923427 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-24  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DataColumnTest.cs : Added SetMaxLength().
+
 2005-01-24  Atsushi Enomoto  <atsushi@ximian.com>
 
        * store2.xsd, store3.xsd, store4.xsd : Added.
index 2c7a7e5ea0ede42f8ca9ca25a863310dd38deec6..64b388ad1ef9ccf206eecef566bda68c2c901f78 100644 (file)
@@ -550,8 +550,19 @@ namespace MonoTests.System.Data
                        AssertEquals ("DC76", "False", T.Rows [4] [2]);
                        AssertEquals ("DC77", "True", T.Rows [1] [2]);
                }
-               
-                [Test]
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void SetMaxColumn ()
+               {
+                       DataSet ds = new DataSet("Example");
+                       ds.Tables.Add("MyType");
+                       ds.Tables["MyType"].Columns.Add(new DataColumn("Desc", 
+                               typeof (string), "", MappingType.SimpleContent));
+                       ds.Tables["MyType"].Columns["Desc"].MaxLength = 32;
+               }
+
+               [Test]
                 public void AdditionToConstraintCollectionTest()
                 {
                         DataTable myTable = new DataTable("myTable");