92 for (
int i = 0; i < properties.
Count; i++)
118 object value =
pd.GetValue(instance);
119 if (
value is InternalDataCollectionBase ||
value is PropertyCollection ||
string.Equals(
pd.Name,
"Namespace",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"PrimaryKey",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"ColumnName",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"DefaultValue",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"TableName",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"DataSetName",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"AllowDBNull",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"Unique",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"NestedInDataSet",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"Locale",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"CaseSensitive",
StringComparison.Ordinal) ||
string.Equals(
pd.Name,
"RemotingFormat",
StringComparison.Ordinal))
148 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"The DynamicDependency ensures the correct members are preserved.")]
162 return "base64Binary";
198 return "unsignedByte";
214 return "unsignedShort";
218 return "unsignedInt";
222 return "unsignedLong";
250 foreach (
Constraint constraint
in table.Constraints)
280 for (
int i = 0; i <
tables.Count; i++)
309 for (
int i = 0; i <
ds.Tables.Count; i++)
324 for (
int k = 0;
k <
ds.Relations.Count;
k++)
342 rootSchema.SetAttribute(
"xmlns:xs",
"http://www.w3.org/2001/XMLSchema");
343 rootSchema.SetAttribute(
"xmlns:msdata",
"urn:schemas-microsoft-com:xml-msdata");
346 rootSchema.SetAttribute(
"xmlns:msprop",
"urn:schemas-microsoft-com:xml-msprop");
350 rootSchema.SetAttribute(
"attributeFormDefault",
"qualified");
351 rootSchema.SetAttribute(
"elementFormDefault",
"qualified");
373 for (
int i = 0; i <
dt.Count; i++)
463 if (
dataTable.ParentRelations.Count == 0)
469 for (
int j = 0;
j <
dataTable.ParentRelations.Count;
j++)
501 _dsElement =
xd.CreateElement(
"xs",
"element",
"http://www.w3.org/2001/XMLSchema");
513 if (
dt.DataSet !=
null)
606 for (
int i = 0; i <
array.Length; i++)
616 if (
array[i].SelfNested)
620 if (
array[i].NestedParentsCount > 1)
626 if (
array[i].MinOccurs != 1
m)
630 if (
array[i].MaxOccurs == -1
m)
632 xmlElement3.SetAttribute(
"maxOccurs",
"unbounded");
634 else if (
array[i].MaxOccurs != 1
m)
672 for (
int j = 0;
j <
ds.Relations.Count;
j++)
691 xmlElement6 =
xd.CreateElement(
"xs",
"annotation",
"http://www.w3.org/2001/XMLSchema");
693 xmlElement7 =
xd.CreateElement(
"xs",
"appinfo",
"http://www.w3.org/2001/XMLSchema");
818 _dsElement =
xd.CreateElement(
"xs",
"element",
"http://www.w3.org/2001/XMLSchema");
851 if (
dt.Namespace.Length == 0)
899 if (
dt.CaseSensitive)
916 xmlElement2.SetAttribute(
"maxOccurs",
"unbounded");
988 xw.WriteAttributeString(
"msdata",
"SchemaSerializationMode",
"urn:schemas-microsoft-com:xml-msdata",
"ExcludeSchema");
995 XmlElement xmlElement =
dc.CreateElement(
"msdata",
"Relationship",
"urn:schemas-microsoft-com:xml-msdata");
997 xmlElement.SetAttribute(
"parent",
"urn:schemas-microsoft-com:xml-msdata",
rel.ParentKey.Table.EncodedTableName);
998 xmlElement.SetAttribute(
"child",
"urn:schemas-microsoft-com:xml-msdata",
rel.ChildKey.Table.EncodedTableName);
1001 xmlElement.SetAttribute(
"ParentTableNamespace",
"urn:schemas-microsoft-com:xml-msdata",
rel.ParentKey.Table.Namespace);
1005 xmlElement.SetAttribute(
"ChildTableNamespace",
"urn:schemas-microsoft-com:xml-msdata",
rel.ChildKey.Table.Namespace);
1020 xmlElement.SetAttribute(
"parentkey",
"urn:schemas-microsoft-com:xml-msdata",
value);
1040 xmlElement.SetAttribute(
"childkey",
"urn:schemas-microsoft-com:xml-msdata",
value);
1068 if (!
string.IsNullOrEmpty(NamespaceURI))
1082 string name =
"type";
1087 if (
col.SimpleType !=
null)
1169 root.
SetAttribute(
"DataType",
"urn:schemas-microsoft-com:xml-msdata",
col.DataType.FullName);
1171 else if (
text.Length == 0 ||
col.ImplementsINullable || (
text ==
"anyType" &&
col.XmlDataType !=
"anyType"))
1178 root.
SetAttribute(
"ReadOnly",
"urn:schemas-microsoft-com:xml-msdata",
"true");
1180 if (
col.Expression.Length != 0)
1182 root.
SetAttribute(
"Expression",
"urn:schemas-microsoft-com:xml-msdata",
col.Expression);
1184 if (
col.AutoIncrement)
1186 root.
SetAttribute(
"AutoIncrement",
"urn:schemas-microsoft-com:xml-msdata",
"true");
1188 if (
col.AutoIncrementSeed != 0
L)
1192 if (
col.AutoIncrementStep != 1)
1196 if (
col.Caption !=
col.ColumnName)
1198 root.
SetAttribute(
"Caption",
"urn:schemas-microsoft-com:xml-msdata",
col.Caption);
1200 if (
col.Prefix.Length != 0)
1202 root.
SetAttribute(
"Prefix",
"urn:schemas-microsoft-com:xml-msdata",
col.Prefix);
1206 root.
SetAttribute(
"DateTimeMode",
"urn:schemas-microsoft-com:xml-msdata",
col.DateTimeMode.ToString());
1213 if (
string.IsNullOrEmpty(
text))
1224 if (!
string.IsNullOrEmpty(
text))
1245 if (
col.Namespace.Length == 0)
1251 xmlElement.SetAttribute(
"form",
"unqualified");
1266 if (!
col.AllowDBNull)
1268 xmlElement.SetAttribute(
"AllowDBNull",
"urn:schemas-microsoft-com:xml-msdata",
"false");
1270 if (!
col.DefaultValueIsNull)
1274 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1279 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata",
col.ConvertObjectToXml(
col.DefaultValue));
1290 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1294 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata",
col.ConvertObjectToXml(
col.DefaultValue));
1299 xmlElement.SetAttribute(
"default", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1301 else if (!
col.IsCustomType)
1303 xmlElement.SetAttribute(
"default",
col.ConvertObjectToXml(
col.DefaultValue));
1308 xmlElement.SetAttribute(
"targetNamespace",
"urn:schemas-microsoft-com:xml-msdata",
col.Namespace);
1310 else if (
col.Namespace != (
col.Table.TypeName.IsEmpty ?
col.Table.Namespace :
col.Table.TypeName.Namespace) &&
col.Namespace.Length != 0)
1324 int num = ((!
col.AllowDBNull) ? 1 : 0);
1331 xmlElement.SetAttribute(
"use",
"prohibited");
1438 text =
string.Empty;
1460 if (
rel.ExtendedProperties.Count > 0)
1473 if (
unique.Key.ColumnsReference.Length != 1)
1477 if (
unique.ExtendedProperties.Count > 0)
1507 if (
fk.ExtendedProperties.Count > 0)
1511 if (
fk.AcceptRejectRule != 0)
1515 if (
fk.DeleteRule !=
Rule.Cascade)
1519 if (
fk.DeleteRule !=
Rule.Cascade)
1523 if (
fk.RelatedColumnsReference.Length != 1)
1554 while (
string.IsNullOrEmpty(
text))
1580 xmlElement.SetAttribute(
"form",
"unqualified");
1586 xmlElement.SetAttribute(
"CaseSensitive",
"urn:schemas-microsoft-com:xml-msdata", table.
CaseSensitive.ToString());
1669 if (!
xmlText.DefaultValueIsNull)
1672 xmlElement5.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata",
xmlText.ConvertObjectToXml(
xmlText.DefaultValue));
1674 xmlElement5.SetAttribute(
"ColumnName",
"urn:schemas-microsoft-com:xml-msdata",
xmlText.ColumnName);
1682 xmlElement4 =
dc.CreateElement(
"xs",
"sequence",
"http://www.w3.org/2001/XMLSchema");
1709 xmlElement8 =
dc.CreateElement(
"xs",
"element",
"http://www.w3.org/2001/XMLSchema");
1714 xmlElement8 =
dc.CreateElement(
"xs",
"element",
"http://www.w3.org/2001/XMLSchema");
1724 xmlElement8.SetAttribute(
"maxOccurs",
"unbounded");
1736 xmlElement8 =
dc.CreateElement(
"xs",
"element",
"http://www.w3.org/2001/XMLSchema");
1772 xmlElement11 =
dc.CreateElement(
"xs",
"unique",
"http://www.w3.org/2001/XMLSchema");
1775 xmlElement11.SetAttribute(
"TableNamespace",
"urn:schemas-microsoft-com:xml-msdata", table.
Namespace);
1788 xmlElement11.SetAttribute(
"PrimaryKey",
"urn:schemas-microsoft-com:xml-msdata",
"true");
1837 xmlElement11 =
dc.CreateElement(
"xs",
"key",
"http://www.w3.org/2001/XMLSchema");
1841 xmlElement11.SetAttribute(
"TableNamespace",
"urn:schemas-microsoft-com:xml-msdata", table.
Namespace);
1843 xmlElement12 =
dc.CreateElement(
"xs",
"selector",
"http://www.w3.org/2001/XMLSchema");
1876 xmlElement11 =
dc.CreateElement(
"xs",
"keyref",
"http://www.w3.org/2001/XMLSchema");
1897 xmlElement11.SetAttribute(
"ConstraintOnly",
"urn:schemas-microsoft-com:xml-msdata",
"true");
1903 xmlElement11.SetAttribute(
"IsNested",
"urn:schemas-microsoft-com:xml-msdata",
"true");
1911 xmlElement12 =
dc.CreateElement(
"xs",
"selector",
"http://www.w3.org/2001/XMLSchema");
1971 if (!
string.IsNullOrEmpty(
value))
1980 if (
string.IsNullOrEmpty(
value))
virtual int Add(object? value)
virtual bool Contains(object? item)
virtual void CopyTo(Array array)
static readonly DesignerSerializationVisibilityAttribute Visible
static PropertyDescriptorCollection GetProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
static ? string ToString(object? value)
static bool IsCatchableExceptionType(Exception e)
static object ConvertFromBigInteger(BigInteger value, Type type, IFormatProvider formatProvider)
static string GetQualifiedName(Type type)
static bool IsTypeCustomType(Type type)
static object ChangeTypeForXML(object value, Type type)
virtual string ConstraintName
DataTableCollection Tables
PropertyCollection _extendedProperties
int InternalIndexOf(string tableName)
PropertyCollection _extendedProperties
ConstraintCollection Constraints
DataColumnCollection Columns
XmlQualifiedName TypeName
bool ShouldSerializeCaseSensitive()
bool ShouldSerializeLocale()
DataRelation[] NestedParentRelations
DataRelationCollection ChildRelations
static Exception InvalidDataColumnMapping(Type type)
static void ThrowMultipleTargetConverter(Exception innerException)
static string QualifiedName(string prefix, string name)
SimpleType(string baseType)
static bool FEqualIdentity(XmlNode node, string name, string ns)
static bool IsXsdType(string name)
static string QualifiedName(string name)
static void ValidateColumnMapping(Type columnType)
static void AddExtendedProperties(PropertyCollection props, XmlElement node, Type type)
void GenerateConstraintNames(ArrayList tables)
void Save(DataTable dt, XmlWriter xw)
void Save(DataSet ds, DataTable dt, XmlWriter xw)
static bool AutoGenerated(ForeignKeyConstraint fk, bool checkRelation)
static bool AutoGenerated(DataColumn col)
XmlElement FillDataSetElement(XmlDocument xd, DataSet ds, DataTable dt)
void Save(DataSet ds, DataTable dt, XmlWriter xw, bool writeHierarchy)
void SetupAutoGenerated(DataSet ds)
void SetupAutoGenerated(DataTable dt)
static bool AutoGenerated(DataRelation rel)
readonly ArrayList _tables
static string TranslateRule(Rule rule)
static string XmlDataTypeName(Type type)
void HandleColumnType(DataColumn col, XmlDocument dc, XmlElement root, XmlElement schema)
void Save(DataSet ds, XmlWriter xw)
void SetPath(XmlWriter xw)
XmlElement HandleColumn(DataColumn col, XmlDocument dc, XmlElement schema, bool fWriteOrdinal)
void SetMSDataAttribute(XmlElement root, Type type)
XmlTreeGen(SchemaFormat format)
XmlElement GetSchema(string NamespaceURI)
static string TranslateAcceptRejectRule(AcceptRejectRule rule)
static bool _PropsNotEmpty(PropertyCollection props)
void AddXdoProperties(object instance, XmlElement root, XmlDocument xd)
XmlElement SchemaTree(XmlDocument xd, DataTable dt)
DataTable[] CreateToplevelTables()
void AddColumnProperties(DataColumn col, XmlElement root)
void Save(DataSet ds, DataTable dt, XmlWriter xw, bool writeHierarchy, Converter< Type, string > multipleTargetConverter)
bool AutoGenerated(ForeignKeyConstraint fk)
void SchemaTree(XmlDocument xd, XmlWriter xmlWriter, DataSet ds, DataTable dt, bool writeHierarchy)
Converter< Type, string > _targetConverter
XmlElement HandleRelation(DataRelation rel, XmlDocument dc)
readonly SchemaFormat _schFormat
void AppendChildWithoutRef(XmlElement node, string Namespace, XmlElement el, string refString)
bool IsAutoGenerated(object o)
ArrayList _constraintNames
bool HaveExtendedProperties(DataSet ds)
void WriteSchemaRoot(XmlDocument xd, XmlElement rootSchema, string targetNamespace)
static void AddExtendedProperties(PropertyCollection props, XmlElement node)
bool ContainsDesignerSerializationVisibleAttribute(PropertyDescriptor pd)
void CreateRelations(DataTable dt)
XmlElement _constraintSeparator
XmlElement FindTypeNode(XmlElement node, string strType)
void GenerateConstraintNames(DataTable table, bool fromTable)
readonly ArrayList _relations
XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement schema)
void GenerateConstraintNames(DataSet ds)
bool HasMixedColumns(DataTable table)
static bool AutoGenerated(UniqueConstraint unique)
void AddXdoProperty(PropertyDescriptor pd, object instance, XmlElement root, XmlDocument xd)
string FindTargetNamespace(DataTable table)
void CreateTablesHierarchy(DataTable dt)
static XmlElement FindSimpleType(XmlElement schema, string name)
XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement schema, bool genNested)
void SetupAutoGenerated(ArrayList dt)
override string ToString()
static CultureInfo CurrentCulture
static CultureInfo InvariantCulture
static ? string GetFileNameWithoutExtension(string? path)
static ? string GetExtension(string? path)
static ? string GetDirectoryName(string? path)
static ? string EncodeLocalName(string? name)
virtual void Save(string filename)
XmlElement CreateElement(string name)
override void WriteTo(XmlWriter w)
virtual void SetAttribute(string name, string? value)
virtual ? XmlNode AppendChild(XmlNode newChild)
virtual ? XmlNode PrependChild(XmlNode newChild)
virtual ? XmlNode InsertAfter(XmlNode newChild, XmlNode? refChild)
virtual ? XmlNode InsertBefore(XmlNode newChild, XmlNode? refChild)
virtual XmlNode RemoveChild(XmlNode oldChild)
virtual ? XmlNode FirstChild
void WriteStartDocument()
DynamicallyAccessedMemberTypes