Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddColumnProperties()

void System.Data.XmlTreeGen.AddColumnProperties ( DataColumn col,
XmlElement root )
inlinepackage

Definition at line 1162 of file XmlTreeGen.cs.

1163 {
1164 if (col.DataType != typeof(string))
1165 {
1166 string text = XmlDataTypeName(col.DataType);
1167 if ((col.IsSqlType && (text.Length == 0 || col.ImplementsINullable)) || typeof(SqlXml) == col.DataType || col.DataType == typeof(DateTimeOffset) || col.DataType == typeof(BigInteger))
1168 {
1169 root.SetAttribute("DataType", "urn:schemas-microsoft-com:xml-msdata", col.DataType.FullName);
1170 }
1171 else if (text.Length == 0 || col.ImplementsINullable || (text == "anyType" && col.XmlDataType != "anyType"))
1172 {
1173 SetMSDataAttribute(root, col.DataType);
1174 }
1175 }
1176 if (col.ReadOnly)
1177 {
1178 root.SetAttribute("ReadOnly", "urn:schemas-microsoft-com:xml-msdata", "true");
1179 }
1180 if (col.Expression.Length != 0)
1181 {
1182 root.SetAttribute("Expression", "urn:schemas-microsoft-com:xml-msdata", col.Expression);
1183 }
1184 if (col.AutoIncrement)
1185 {
1186 root.SetAttribute("AutoIncrement", "urn:schemas-microsoft-com:xml-msdata", "true");
1187 }
1188 if (col.AutoIncrementSeed != 0L)
1189 {
1190 root.SetAttribute("AutoIncrementSeed", "urn:schemas-microsoft-com:xml-msdata", col.AutoIncrementSeed.ToString(CultureInfo.InvariantCulture));
1191 }
1192 if (col.AutoIncrementStep != 1)
1193 {
1194 root.SetAttribute("AutoIncrementStep", "urn:schemas-microsoft-com:xml-msdata", col.AutoIncrementStep.ToString(CultureInfo.InvariantCulture));
1195 }
1196 if (col.Caption != col.ColumnName)
1197 {
1198 root.SetAttribute("Caption", "urn:schemas-microsoft-com:xml-msdata", col.Caption);
1199 }
1200 if (col.Prefix.Length != 0)
1201 {
1202 root.SetAttribute("Prefix", "urn:schemas-microsoft-com:xml-msdata", col.Prefix);
1203 }
1204 if (col.DataType == typeof(DateTime) && col.DateTimeMode != DataSetDateTime.UnspecifiedLocal)
1205 {
1206 root.SetAttribute("DateTimeMode", "urn:schemas-microsoft-com:xml-msdata", col.DateTimeMode.ToString());
1207 }
1208 }
static string XmlDataTypeName(Type type)
void SetMSDataAttribute(XmlElement root, Type type)
static CultureInfo InvariantCulture
virtual void SetAttribute(string name, string? value)

References System.Xml.Dictionary, System.Globalization.CultureInfo.InvariantCulture, System.L, System.Xml.XmlElement.SetAttribute(), System.Data.XmlTreeGen.SetMSDataAttribute(), System.text, and System.Data.XmlTreeGen.XmlDataTypeName().

Referenced by System.Data.XmlTreeGen.HandleColumn(), and System.Data.XmlTreeGen.HandleTable().