class
ManagedSerializableDelta
Handles creation and applying of managed deltas.
A delta contains differences between two objects of identical types. If the initial state of an object is known the recorded differences can be saved and applied to the original state to restore the modified object.
Differences are recorded per primitive field in an object. Complex objects are recursed. Special handling is implemented to properly generate deltas for individual entries within arrays, lists and dictionaries.
All primitive types supported by managed serialization are supported (see ScriptPrimitiveType).
Public
Constructors
ManagedSerializableDelta
Methods
~ManagedSerializableDelta
staticCreate
Generates a new managed delta by comparing two objects.
Caller must ensure both objects are not null and of identical types.
- original
- Original object to compared with . This is the object you can apply the delta to to convert it to .
- modified
- Modified object. Any values in this object that differ from the original object will be recorded in the delta.
Returns: Returns null if objects are identical.
Apply
Applies the delta stored in this object to the specified object, modifying all fields in the object to correspond to the delta.
staticGetRttiStatic
Private
Methods
GenerateObjectDelta
Recursively generates a delta between all fields of the specified objects.
Returns null if objects are identical.
GenerateFieldDelta
Generates a delta between two fields.
Fields can be of any type and the system will generate the delta appropriately. Delta is generated recursively on all complex objects. Returns null if fields contain identical data.
ApplyObjectDelta
Applies an object modification to a managed object.
Modifications are applied recursively.
- delta
- Object modification to apply.
- object
- Object to apply the modification to.
Returns: New field data in the case modification needed the object to be re-created instead of just modified.
ApplyArrayDelta
Applies an array modification to a managed array.
Modifications are applied recursively.
- delta
- Array modification to apply.
- object
- Array to apply the modification to.
Returns: New field data in the case modification needed the array to be re-created instead of just modified.
ApplyListDelta
Applies an list modification to a managed list.
Modifications are applied recursively.
- delta
- List modification to apply.
- object
- List to apply the modification to.
Returns: New field data in the case modification needed the list to be re-created instead of just modified.
ApplyDictionaryDelta
Applies an dictionary modification to a managed dictionary.
Modifications are applied recursively.
- delta
- Dictionary modification to apply.
- object
- Dictionary to apply the modification to.
Returns: New field data in the case modification needed the dictionary to be re-created instead of just modified.
ApplyDiff
Applies a modification to a single field.
Field type is determined and the modification is applied to the specific field type as needed. Modifications are applied recursively.
- delta
- Modification to apply.
- fieldType
- Type of the field we're applying the modification to.
- fieldData
- Original data of the field, to apply the modification to.
Returns: New field data in the case modification needed the field data to be re-created instead of just modified.