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> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access