Relationship Between XML Schemas and Datasets
A typed ADO.NET dataset is a class with an associated XML Schema, as opposed to an untyped dataset that is not a class and has no associated schema. The typed dataset class is derived from a dataset class, which inherits all of the methods, events and properties of a dataset. Additionally, a typed dataset provides strongly typed methods, events, and properties meaning you can access tables and columns by name, instead of iterating through collections. A typed dataset also incorporates table and column names into the statement completion feature of Visual Studio. This facilitates code that is both easier to write as well as read. Additionally, with a typed dataset, type mismatch errors are caught when the code is compiled rather than at run-time.
When a typed dataset is generated at design time, a dataset class and an associated XML Schema is created in your project. XML Schemas define and validate the data being imported from XML streams or documents into typed datasets. The XML Schema associated with the dataset can be loading into the XML Designer providing a visual representation of the dataset structure that can be edited and viewed.
Note An untyped ADO.NET dataset is a dataset that does not have an associated XML Schema. Additionally, at design time, datasets do not contain any data. Since an untyped dataset contains no data or structure, XML Schemas cannot be generated from untyped datasets at design time. During run time, once the dataset has been populated with data, an XML Schema based on that data could be generated programmatically.
XML Schemas in Visual Studio conform to the specification for schemas published by the World Wide Web Consortium (W3C). Schema elements, whether created to validate XML documents or to define associated dataset classes, are all defined in accordance with the W3C schema specification. In situations where schema syntax is not sufficient to describe certain features of ADO.NET datasets, custom attributes are used to define ADO.NET specific characteristics. While viewing a schema in XML view these custom attributes can be identified with the msdata: qualifier. However, it is important to note that the W3C spec permits custom attributes, which will be ignored by applications that do not process ADO.NET datasets.
|For more reading on||See|
|The relationship between datasets and XML Schemas||Introduction to Data Access with ADO.NET|
|Creating datasets from schemas||Creating ADO.NET Typed Datasets from Schemas|
|.NET Framework reference (syntax and class members)||DataSet Class|
|XML Schemas||XML Schema Reference (XSD)|
Creating XML Schemas and Datasets | Creating XML Schemas and Datasets from Existing Data | Creating New Typed Datasets with the XML Designer | Relational Data in XML Schemas | XML Files | XML Schemas and Data | Introduction to Data Access with ADO.NET | Introduction to Datasets