msdata Namespace

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 id="DataSetName" xmlns="" 

    xmlns:xs="http://www.w3.org/2001/XMLSchema"

    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" >

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 name="DataSetName" msdata:IsDataSet="true" >

The element tag also supports optional CaseSensitive and Local attributes:

<xs:element name="DataSetName"

    msdata:CaseSensitive="true" msdata:Locale="en">

More importantly, the msdata namespace represents various DataColumn properties that don’t have direct XSD mappings. Table B-4 lists these.

Table B-4. msdata column attributes

Attribute

Description

AutoIncrement, AutoIncrementSeed, AutoIncrementStep

Sets the auto-incrementing options for unique identity fields. These attributes map to corresponding DataColumn properties.

Caption

Specifies the display caption for the column. Maps to DataColumn.Caption.

Expression

Sets the expression used to filter rows, calculate the values in a column, or create an aggregate column. Maps to DataColumn.Expression.

ReadOnly

Indicates (true or false ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.