Appendix B. ADO.NET XML Extensions

Microsoft defines two namespaces for configuring DataSet schema files: codegen (urn:schemas-microsoft-com:xml-msprop) and msdata (urn:schemas-microsoft-com:xml-msdata). These namespaces extend the XSD format, allowing it to represent additional database-specific properties and allowing you to configure how typed DataSets are generated. In addition, the diffgr , or DiffGram namespace (urn:schemas-microsoft-com:xml-diffgram-v1), defines attributes that provide a way for XML documents to track DataSet changes and row insertions and deletions.

The structure of the XSD file for a DataSet is as follows:

<?xml version="1.0" encoding="utf-8"?>

<xs:schema id="DataSetName">



  <xs:element name="DataSetName" >

    <xs:complexType>

      <xs:choice maxOccurs="unbounded">



        <xs:element name="DataTableName" >

          <xs:complexType>

            <xs:sequence>



              <xs:element name="FieldName" />



          </xs:complexType>

        </xs:element>



      </xs:choice>

    </xs:complexType>



    <xs:unique name="ConstraintName" />

    <xs:keyref name="RelationName" />



  </xs:element>

</xs:schema>

The structure of the DiffGram format is shown next. All DiffGrams contains three sections: the current data, the original data, and any errors.

<?xml version="1.0"?> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- Data goes here. Changed rows are flagged. --> <diffgr:before> <!-- Contains the original data. --> </diffgr:before> ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.