Stateful data serialization
-
Upload
raghu-nath -
Category
Education
-
view
31 -
download
1
Transcript of Stateful data serialization
Stateful Data Serialization
• The DataSet object is designed with data disconnection in mind and with the assumption that optimistic concurrency is the default. In a multiple-user environment, optimistic concurrency occurs when applications do not lock a row while reading it. In contrast, a pessimistic form of concurrency involves locking rows at the data source to prevent users from modifying data in a way that affects other users. The DataSet object abstracts from the physical data source and qualifies itself as a superarray component capable of containing in-memory data.
• As a container of disconnected data, the DataSet object accepts any sort of update to the rows it contains, so you can add new rows to any child tables, and you can update or delete existing rows. All these changes are persisted in memory and are not passed on to a persistent storage medium until an explicit update operation is conducted. Such an update requires a new connection and applies an array of changes in a single shot. For this reason, a DataSet update operation is often referred to as a batch update. When the batch update is completed, the DataSet in-memory changes are automatically committed to ensure consistency between the in-memory cache and the underlying storage medium.
Overview of the DiffGram Format
• A DiffGram is an XML serialization format that includes both the original values and the current values of each row in each table. In particular, a DiffGram contains the current instance of rows with the up-to-date values, plus a section where all the original values for changed rows are grouped.
Components that work under the hood of the DataSet object's WriteXml
method.
Reading Back DiffGrams
The Row Commit Model
• The DataSet, DataTable, and DataRow objects maintain a local cache of changes. When a row is modified, deleted, or added, its state changes to one of the values of the DataRowState enumeration. (See the .NET Framework documentation for details.) Similarly, when a row is added, modified, or deleted from a table, the internal state of the table is altered, resulting in pending changes for the affected rows.
Constituent parts of a disconnected save-and-resume application.