New to Telerik UI for WPFStart a free 30-day trial

Manager class for serialization and deserialization.

Definition

Namespace:Telerik.Windows.Persistence

Assembly:Telerik.Windows.PersistenceFramework.dll

Syntax:

C#
public class PersistenceManager : DependencyObject, IAllowedTypesSupport

Inheritance: objectPersistenceManager

Implements: IAllowedTypesSupport

Constructors

Initializes a new instance of the PersistenceManager class.

C#
public PersistenceManager()

Fields

Defines the SerializationOptions dependency property.

C#
public static readonly DependencyProperty SerializationOptionsProperty

StorageIdProperty

DependencyProperty

Defines the StorageId dependency property.

C#
public static readonly DependencyProperty StorageIdProperty

Properties

Gets or sets a value indicating whether you can deserialize Telerik controls with different version.

C#
public bool AllowCrossVersion { get; set; }

Gets or sets a collection of types, which are allowed to be instantiated by the deserialization mechanism.

C#
public ICollection<Type> AllowedTypes { get; set; }

Implements: IAllowedTypesSupport.AllowedTypes

Gets or sets the deserialized used for deserialization.

C#
protected IDeserializer Deserializer { get; set; }

Gets or sets the Serializer used for serialization.

C#
protected ISerializer Serializer { get; set; }

Methods

Gets the deserialization object used for deserialization.

C#
protected virtual IDeserializer GetDeserializerOverride()
Returns:

IDeserializer

C#
public static SerializationMetadataCollection GetSerializationOptions(DependencyObject obj)
Parameters:objDependencyObjectReturns:

SerializationMetadataCollection

Gets the serialized used for serialization.

C#
protected virtual ISerializer GetSerializerOverride()
Returns:

ISerializer

Returns the serializer.

Gets the current storage with the serialization objects.

C#
public static ObjectStorage GetStorage()
Returns:

ObjectStorage

C#
public static string GetStorageId(DependencyObject obj)
Parameters:objDependencyObjectReturns:

string

Loads the specified object.

C#
public virtual void Load(object obj, Stream stream)
Parameters:objobject

The object.

streamStream

The stream.

Loads the objects from the specified stream.

C#
public virtual void Load(Stream stream)
Parameters:streamStream

The stream.

Remarks:

The persisted data will be restored on the objects, that have StorageIdProperty property set.

Raises the PersistenceError event.

C#
protected virtual void OnPersistenceError(PersistenceErrorEventArgs args)
Parameters:argsPersistenceErrorEventArgs

Event args.

Raises the PropertyPersisted event.

C#
protected virtual void OnPropertyPersisted(PersistenceEventArgs args)
Parameters:argsPersistenceEventArgs

Event args.

Raises the PropertyPersistenceCompleted event.

C#
protected virtual void OnPropertyPersistenceCompleted(EventArgs args)
Parameters:argsEventArgs

Event args.

Raises the PropertyPersisting event.

C#
protected virtual bool OnPropertyPersisting(PersistingPropertyEventArgs args)
Parameters:argsPersistingPropertyEventArgs

Event args.

Returns:

bool

Returns true if the event is to be cancelled.

Raises the PropertyRestored event.

C#
protected virtual void OnPropertyRestored(PersistenceEventArgs args)
Parameters:argsPersistenceEventArgs

Event args.

Raises the PropertyRestoring event.

C#
protected virtual bool OnPropertyRestoring(RestoringPropertyEventArgs args)
Parameters:argsRestoringPropertyEventArgs

Event args.

Returns:

bool

Returns true if the event is to be cancelled.

Raises the PropertyRestoringCompleted event.

C#
protected virtual void OnPropertyRestoringCompleted(EventArgs args)
Parameters:argsEventArgs

Event args.

Raises the event.

C#
protected virtual Type OnTypeRestored(TypeRestoredEventArgs args)
Parameters:argsTypeRestoredEventArgs

The TypeRestoredEventArgs instance containing the event data.

Returns:

Type

Overrides the storage.

C#
public static void OverrideStorage(ObjectStorage newStorage)
Parameters:newStorageObjectStorage

The new storage.

Saves the specified object.

C#
public virtual Stream Save()
Returns:

Stream

Returns the serialized stream.

Remarks:

This method will serialize the objects, which have StorageIdProperty property set.

Saves the specified object.

C#
public virtual Stream Save(object obj)
Parameters:objobject

The object.

Returns:

Stream

Returns the serialized stream.

C#
public static void SetSerializationOptions(DependencyObject obj, SerializationMetadataCollection value)
Parameters:objDependencyObjectvalueSerializationMetadataCollection
C#
public static void SetStorageId(DependencyObject obj, string value)
Parameters:objDependencyObjectvaluestring

Events

Raised when an error occurs while persisting or restoring.

C#
public event PersistenceErrorEventHandler PersistenceError

Raised when a property has been persisted.

C#
public event PropertyPersistedEventHandler PropertyPersisted

Raised when all properties have been persisted.

C#
public event PropertyPersistenceCompletedEventHandler PropertyPersistenceCompleted

Raised when a property is being persisted.

C#
public event PropertyPersistingEventHandler PropertyPersisting

Raised when a property has been restored.

C#
public event PropertyRestoredEventHandler PropertyRestored

Raised when a property is being restored.

C#
public event PropertyRestoringEventHandler PropertyRestoring

Raised when all properties has been restored.

C#
public event PropertyRestoringCompletedEventHandler PropertyRestoringCompleted

Occurs when type is restored.

C#
public event EventHandler<TypeRestoredEventArgs> TypeRestored