PersistenceManager
Manager class for serialization and deserialization.
Definition
Namespace:Telerik.Windows.Persistence
Assembly:Telerik.Windows.PersistenceFramework.dll
Syntax:
public class PersistenceManager : DependencyObject, IAllowedTypesSupport
Inheritance: objectPersistenceManager
Implements:
Constructors
Initializes a new instance of the PersistenceManager class.
public PersistenceManager()
Fields
SerializationOptionsProperty
DependencyProperty
Defines the SerializationOptions dependency property.
public static readonly DependencyProperty SerializationOptionsProperty
StorageIdProperty
DependencyProperty
Defines the StorageId dependency property.
public static readonly DependencyProperty StorageIdProperty
Properties
Gets or sets a value indicating whether you can deserialize Telerik controls with different version.
public bool AllowCrossVersion { get; set; }
Gets or sets a collection of types, which are allowed to be instantiated by the deserialization mechanism.
public ICollection<Type> AllowedTypes { get; set; }
Implements:
Gets or sets the deserialized used for deserialization.
protected IDeserializer Deserializer { get; set; }
Gets or sets the Serializer used for serialization.
protected ISerializer Serializer { get; set; }
Methods
Gets the deserialization object used for deserialization.
public static SerializationMetadataCollection GetSerializationOptions(DependencyObject obj)
Gets the serialized used for serialization.
protected virtual ISerializer GetSerializerOverride()
Returns the serializer.
Gets the current storage with the serialization objects.
public static string GetStorageId(DependencyObject obj)
Loads the objects from the specified stream.
public virtual void Load(Stream stream)
The stream.
The persisted data will be restored on the objects, that have StorageIdProperty property set.
Raises the PersistenceError event.
protected virtual void OnPersistenceError(PersistenceErrorEventArgs args)
Event args.
Raises the PropertyPersisted event.
protected virtual void OnPropertyPersisted(PersistenceEventArgs args)
Event args.
Raises the PropertyPersistenceCompleted event.
protected virtual void OnPropertyPersistenceCompleted(EventArgs args)
Event args.
Raises the PropertyPersisting event.
protected virtual bool OnPropertyPersisting(PersistingPropertyEventArgs args)
Event args.
Returns:Returns true if the event is to be cancelled.
Raises the PropertyRestored event.
protected virtual void OnPropertyRestored(PersistenceEventArgs args)
Event args.
Raises the PropertyRestoring event.
protected virtual bool OnPropertyRestoring(RestoringPropertyEventArgs args)
Event args.
Returns:Returns true if the event is to be cancelled.
Raises the PropertyRestoringCompleted event.
protected virtual void OnPropertyRestoringCompleted(EventArgs args)
Event args.
Raises the event.
protected virtual Type OnTypeRestored(TypeRestoredEventArgs args)
The TypeRestoredEventArgs instance containing the event data.
Returns:Overrides the storage.
public static void OverrideStorage(ObjectStorage newStorage)
The new storage.
Saves the specified object.
public virtual Stream Save()
Returns the serialized stream.
This method will serialize the objects, which have StorageIdProperty property set.
public static void SetSerializationOptions(DependencyObject obj, SerializationMetadataCollection value)
public static void SetStorageId(DependencyObject obj, string value)
Events
Raised when an error occurs while persisting or restoring.
public event PersistenceErrorEventHandler PersistenceError
Raised when a property has been persisted.
public event PropertyPersistedEventHandler PropertyPersisted
Raised when all properties have been persisted.
public event PropertyPersistenceCompletedEventHandler PropertyPersistenceCompleted
Raised when a property is being persisted.
public event PropertyPersistingEventHandler PropertyPersisting
Raised when a property has been restored.
public event PropertyRestoredEventHandler PropertyRestored
Raised when a property is being restored.
public event PropertyRestoringEventHandler PropertyRestoring
Raised when all properties has been restored.
public event PropertyRestoringCompletedEventHandler PropertyRestoringCompleted
Occurs when type is restored.
public event EventHandler<TypeRestoredEventArgs> TypeRestored