天道酬勤,厚德载物

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

The nature of a DataSet requires that it is either typed or untyped. By definition a typed DataSet is any DataSet that is derived from the base DataSet class that applies the information contained in the XSD to generate a typed class. Information from the schema that contains the tables, columns, and rows is generated and compiled into a new DataSet derived from the XSD and this promotes the DataSet to a first class object in the .NET Framework.

The process of inheriting the typed DataSet from the base DataSet class means that the typed class assumes all functionality of the DataSet class and can be used with methods that take an instance of the DataSet class as a parameter. This is the opposite of the untyped DataSet that has no corresponding schema and is exposed only as a collection.


Typed versus Untyped Datasets
Datasets can be typed or untyped. A typed dataset is a dataset that is first derived from the base DataSet class and then uses information in an XML Schema file (an .xsd file) to generate a new class. Information from the schema (tables, columns, and so on) is generated and compiled into this new dataset class as a set of first-class objects and properties.

Note   For more information about dataset schemas, see XML Schemas and Data.
Because a typed DataSet class inherits from the base DataSet class, the typed class assumes all of the functionality of the DataSet class and can be used with methods that take an instance of a DataSet class as a parameter

An untyped dataset, in contrast, has no corresponding built-in schema. As in a typed dataset, an untyped dataset contains tables, columns, and so on — but those are exposed only as collections. (However, after manually creating the tables and other data elements in an untyped dataset, you can export the dataset's structure as a schema using the dataset's WriteXmlSchema method.)



强类型dataset 是特殊化的DataSet
强类型DataSet是从DataSet继承的定制对象,它可以通
过其显露的属性(properties)来对封装数据进行强类型
的访问。
强类型DataSet避免了字段的晚绑定。强类型DataSet提
供了强类型的访问器,因为避免了到一个集合中查找列名
或表名,访问时更快。
除了能够提高运行时的性能,强类型DataSet还提供了类
型检查,并且在设计时可以通过自定义字段名对字段智能
感知。

posted on 2007-11-20 12:34  cobbles  阅读(169)  评论(0编辑  收藏  举报