本文整理汇总了C#中DataSet.GetXmlSchema方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.GetXmlSchema方法的具体用法?C# DataSet.GetXmlSchema怎么用?C# DataSet.GetXmlSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.GetXmlSchema方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoIncrementStep
public void AutoIncrementStep()
{
DataSet ds = new DataSet("testds");
DataTable tbl = ds.Tables.Add("testtbl");
DataColumn col = tbl.Columns.Add("id", typeof(int));
col.AutoIncrement = true;
col.AutoIncrementSeed = -1;
col.AutoIncrementStep = -1;
tbl.Columns.Add("data", typeof(string));
Assert.True(ds.GetXmlSchema().IndexOf("AutoIncrementStep") > 0);
}
示例2: Bug420862
public void Bug420862()
{
DataSet ds = new DataSet("d");
DataTable dt = ds.Tables.Add("t");
dt.Columns.Add("c", typeof(ushort));
XmlSchema xs = XmlSchema.Read(new StringReader(ds.GetXmlSchema()), null);
#pragma warning disable 0618
xs.Compile(null);
#pragma warning restore 0618
// follow the nesting of the schema in the foreach
foreach (XmlSchemaElement d in xs.Items)
{
Assert.Equal("d", d.Name);
XmlSchemaChoice dsc = (XmlSchemaChoice)((XmlSchemaComplexType)d.SchemaType).Particle;
foreach (XmlSchemaElement t in dsc.Items)
{
Assert.Equal("t", t.Name);
XmlSchemaSequence tss = (XmlSchemaSequence)((XmlSchemaComplexType)t.SchemaType).Particle;
foreach (XmlSchemaElement c in tss.Items)
{
Assert.Equal("c", c.Name);
Assert.Equal("unsignedShort", c.SchemaTypeName.Name);
return;
}
}
}
Assert.False(true);
}
示例3: InitParentDataTableSchema
private void InitParentDataTableSchema(out XmlDocument schemaDocInit, out XmlNamespaceManager namespaceManagerToInit)
{
var ds = new DataSet();
ds.Tables.Add(DataProvider.CreateParentDataTable());
string strXML = ds.GetXmlSchema();
schemaDocInit = new XmlDocument();
schemaDocInit.LoadXml(strXML);
namespaceManagerToInit = new XmlNamespaceManager(schemaDocInit.NameTable);
namespaceManagerToInit.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
namespaceManagerToInit.AddNamespace("msdata", "urn:schemas-microsoft-com:xml-msdata");
}