private void FillFacet (DataColumn col, XmlSchemaSimpleType st)
{
if (st == null || st.Content == null)
return;
// Handle restriction facets
XmlSchemaSimpleTypeRestriction restriction = st == null ? null : st.Content as XmlSchemaSimpleTypeRestriction;
if (restriction == null)
throw new DataException ("DataSet does not suport 'list' nor 'union' simple type.");
foreach (XmlSchemaFacet f in restriction.Facets) {
if (f is XmlSchemaMaxLengthFacet)
// There is no reason why MaxLength is limited to int, except for the fact that DataColumn.MaxLength property is int.
col.MaxLength = int.Parse (f.Value);
}
}