The msdata namespace extends a XSD document so that it can represent an ADO.NET DataSet. The msdata namespace is also used in XML documents: namely in the DiffGram representation of a DataSet (along with the diffgr namespace). Here's an example of how the msdata namespace is imported in an XSD file:
<xs:schema
One place where you'll see the msdata namespace is in the element tag containing the XSD structure. Here, an IsDataSet attribute indicates that the schema is used to represent an ADO.NET DataSet:
<xs:element
The element tag also supports optional CaseSensitive and Local attributes:
<xs:element
More importantly, the msdata namespace represents various DataColumn properties that don't have direct XSD mappings. Table B-4 lists these.
The msdata namespace is also used with unique elements (to specify a unique constraint for a field), key elements (to specify the primary key for a table), and keyref elements (to specify relations between two tables). These elements are introduced in Chapter 4. See Table B-5 and Table B-6.
When you use a keyref element in a schema, there will be one of two results:
If the ConstraintOnly attribute is false, a ForeignKeyConstraint and a DataRelation object are created and added to the DataSet.
If the ConstraintOnly attribute is true, a ForeignKeyConstraint object is created an added to the DataSet, but a DataRelation isn't.
If you want to create a DataRelation without a ForeignKeyConstraint, you need to add an entirely new element to the schema document: msdata:Relationship. This element is shown below and in Table B-7.
<msdata:Relationship
Finally, the msdata namespace is used with the DiffGram if you want to set a specific column order or hide a row. There are two valid msdata attributes that you can apply to row elements in a DiffGram, and they are described in Table B-8.