Stateful data serialization

10
Stateful Data Serialization

Transcript of Stateful data serialization

Page 1: Stateful data serialization

Stateful Data Serialization

Page 2: 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.

Page 3: Stateful data serialization

• 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.

Page 4: Stateful data serialization

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.

Page 5: Stateful data serialization

Components that work under the hood of the DataSet object's WriteXml

method.

Page 6: Stateful data serialization

Reading Back DiffGrams

Page 7: Stateful data serialization

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.

Page 8: Stateful data serialization

Constituent parts of a disconnected save-and-resume application.

Page 9: Stateful data serialization
Page 10: Stateful data serialization