+2005-02-25 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DataColumn.cs : setting negative value on MaxLength of SimpleContent
+ column is still valid.
+
2005-02-15 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaWriter.cs : new file for outputting XmlSchema.
return maxLength;
}
set {
- if (_columnMapping == MappingType.SimpleContent)
+ if (value >= 0 &&
+ _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;
+2005-02-25 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DataColumnTest.cs : added testcase for setting negative value on
+ DataColumn whose mapping is SimpleContent.
+
2005-02-15 Atsushi Enomoto <atsushi@ximian.com>
* DataSetAssertion.cs : don't exclude those attribute whose namespace
[Test]
[ExpectedException (typeof (ArgumentException))]
- public void SetMaxColumn ()
+ public void SetMaxLengthException ()
{
+ // Setting MaxLength on SimpleContent -> exception
DataSet ds = new DataSet("Example");
ds.Tables.Add("MyType");
ds.Tables["MyType"].Columns.Add(new DataColumn("Desc",
ds.Tables["MyType"].Columns["Desc"].MaxLength = 32;
}
+ [Test]
+ public void SetMaxLengthNegativeValue ()
+ {
+ // however setting MaxLength on SimpleContent is OK
+ 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 = -1;
+ }
+
[Test]
public void AdditionToConstraintCollectionTest()
{