What are DataSets? A DataSet is in effect an in-memory representation of cached, disconnected data that is available as a as a collection of tables, relationships, constraints, etc. In other words, a DataSet is actually an in-memory representation of the entire database along with its tables and relationships. The DataSet class is contained in the System.Data namespace in ADO.NET. The DataSet class has the ability to represent itself as XML upon request or when you pass it through the tiers or components of an application. The primary advantage in using DataSets in applications is its disconnected approach that enables data to be transferred across application boundaries. The primary disadvantage of using DataSets however that is it consumes large amount of memory that is particularly a nightmare if your DataSet contains high volume of data. Hence, it becomes detrimental to the application’s performance when the DataSet contains large amount of data due to excessive consumption of memory.
DataSet and XML – A perfect match
Before we delve deep any further, let us have a recap of XML. What is XML and why is it so useful? Extensible Markup Language (XML) is a simple, platform independent, flexible meta-markup language that provides a format for storing structured data and is great for efficient exchange of data across the internet. XML has rapidly gained wide popularity and the enterprise applications the world over are using XML as the primary format for data exchange across the globe. The salient features of this language are:–- Robust
- Support for UNICODE
- Hierarchical structure
- Platform Independent
- Present in human readable format
- Can support even complex data structures
- The ReadXml Method
- The ReadXmlSchema Method
- The GetXml Method
- The GetXmlSchema Method
- The WriteXml Method
- The WriteXmlSchema Method