Class
PersistenceManager

Manager class for serialization and deserialization.

Definition

Namespace:Telerik.Windows.Persistence

Assembly:Telerik.Windows.PersistenceFramework.dll

Syntax:

cs-api-definition
public class PersistenceManager : DependencyObject, IAllowedTypesSupport

Inheritance: objectPersistenceManager

Implements: IAllowedTypesSupport

Constructors

PersistenceManager()

Initializes a new instance of the PersistenceManager class.

Declaration

cs-api-definition
public PersistenceManager()

Fields

SerializationOptionsProperty

Defines the SerializationOptions dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty SerializationOptionsProperty

Field Value

DependencyProperty

StorageIdProperty

Defines the StorageId dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty StorageIdProperty

Field Value

DependencyProperty

Properties

AllowCrossVersion

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

Declaration

cs-api-definition
public bool AllowCrossVersion { get; set; }

Property Value

bool

AllowedTypes

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

Declaration

cs-api-definition
public ICollection<Type> AllowedTypes { get; set; }

Property Value

ICollection<Type>

Implements IAllowedTypesSupport.AllowedTypes

Deserializer

Gets or sets the deserialized used for deserialization.

Declaration

cs-api-definition
protected IDeserializer Deserializer { get; set; }

Property Value

IDeserializer

Serializer

Gets or sets the Serializer used for serialization.

Declaration

cs-api-definition
protected ISerializer Serializer { get; set; }

Property Value

ISerializer

Methods

GetDeserializerOverride()

Gets the deserialization object used for deserialization.

Declaration

cs-api-definition
protected virtual IDeserializer GetDeserializerOverride()

Returns

IDeserializer

GetSerializationOptions(DependencyObject)

Declaration

cs-api-definition
public static SerializationMetadataCollection GetSerializationOptions(DependencyObject obj)

Parameters

obj

DependencyObject

Returns

SerializationMetadataCollection

GetSerializerOverride()

Gets the serialized used for serialization.

Declaration

cs-api-definition
protected virtual ISerializer GetSerializerOverride()

Returns

ISerializer

Returns the serializer.

GetStorage()

Gets the current storage with the serialization objects.

Declaration

cs-api-definition
public static ObjectStorage GetStorage()

Returns

ObjectStorage

GetStorageId(DependencyObject)

Declaration

cs-api-definition
public static string GetStorageId(DependencyObject obj)

Parameters

obj

DependencyObject

Returns

string

Load(Stream)

Loads the objects from the specified stream.

Declaration

cs-api-definition
public virtual void Load(Stream stream)

Parameters

stream

Stream

The stream.

Remarks

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

Load(object, Stream)

Loads the specified object.

Declaration

cs-api-definition
public virtual void Load(object obj, Stream stream)

Parameters

obj

object

The object.

stream

Stream

The stream.

OnPersistenceError(PersistenceErrorEventArgs)

Raises the PersistenceError event.

Declaration

cs-api-definition
protected virtual void OnPersistenceError(PersistenceErrorEventArgs args)

Parameters

args

PersistenceErrorEventArgs

Event args.

OnPropertyPersisted(PersistenceEventArgs)

Raises the PropertyPersisted event.

Declaration

cs-api-definition
protected virtual void OnPropertyPersisted(PersistenceEventArgs args)

Parameters

args

PersistenceEventArgs

Event args.

OnPropertyPersistenceCompleted(EventArgs)

Raises the PropertyPersistenceCompleted event.

Declaration

cs-api-definition
protected virtual void OnPropertyPersistenceCompleted(EventArgs args)

Parameters

args

EventArgs

Event args.

OnPropertyPersisting(PersistingPropertyEventArgs)

Raises the PropertyPersisting event.

Declaration

cs-api-definition
protected virtual bool OnPropertyPersisting(PersistingPropertyEventArgs args)

Parameters

args

PersistingPropertyEventArgs

Event args.

Returns

bool

Returns true if the event is to be cancelled.

OnPropertyRestored(PersistenceEventArgs)

Raises the PropertyRestored event.

Declaration

cs-api-definition
protected virtual void OnPropertyRestored(PersistenceEventArgs args)

Parameters

args

PersistenceEventArgs

Event args.

OnPropertyRestoring(RestoringPropertyEventArgs)

Raises the PropertyRestoring event.

Declaration

cs-api-definition
protected virtual bool OnPropertyRestoring(RestoringPropertyEventArgs args)

Parameters

args

RestoringPropertyEventArgs

Event args.

Returns

bool

Returns true if the event is to be cancelled.

OnPropertyRestoringCompleted(EventArgs)

Raises the PropertyRestoringCompleted event.

Declaration

cs-api-definition
protected virtual void OnPropertyRestoringCompleted(EventArgs args)

Parameters

args

EventArgs

Event args.

OnTypeRestored(TypeRestoredEventArgs)

Raises the event.

Declaration

cs-api-definition
protected virtual Type OnTypeRestored(TypeRestoredEventArgs args)

Parameters

args

TypeRestoredEventArgs

The TypeRestoredEventArgs instance containing the event data.

Returns

Type

OverrideStorage(ObjectStorage)

Overrides the storage.

Declaration

cs-api-definition
public static void OverrideStorage(ObjectStorage newStorage)

Parameters

newStorage

ObjectStorage

The new storage.

Save()

Saves the specified object.

Declaration

cs-api-definition
public virtual Stream Save()

Returns

Stream

Returns the serialized stream.

Remarks

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

Save(object)

Saves the specified object.

Declaration

cs-api-definition
public virtual Stream Save(object obj)

Parameters

obj

object

The object.

Returns

Stream

Returns the serialized stream.

SetSerializationOptions(DependencyObject, SerializationMetadataCollection)

Declaration

cs-api-definition
public static void SetSerializationOptions(DependencyObject obj, SerializationMetadataCollection value)

Parameters

obj

DependencyObject

value

SerializationMetadataCollection

SetStorageId(DependencyObject, string)

Declaration

cs-api-definition
public static void SetStorageId(DependencyObject obj, string value)

Parameters

obj

DependencyObject

value

string

Events

PersistenceError

Raised when an error occurs while persisting or restoring.

Declaration

cs-api-definition
public event PersistenceErrorEventHandler PersistenceError

Event Value

PersistenceErrorEventHandler

PropertyPersisted

Raised when a property has been persisted.

Declaration

cs-api-definition
public event PropertyPersistedEventHandler PropertyPersisted

Event Value

PropertyPersistedEventHandler

PropertyPersistenceCompleted

Raised when all properties have been persisted.

Declaration

cs-api-definition
public event PropertyPersistenceCompletedEventHandler PropertyPersistenceCompleted

Event Value

PropertyPersistenceCompletedEventHandler

PropertyPersisting

Raised when a property is being persisted.

Declaration

cs-api-definition
public event PropertyPersistingEventHandler PropertyPersisting

Event Value

PropertyPersistingEventHandler

PropertyRestored

Raised when a property has been restored.

Declaration

cs-api-definition
public event PropertyRestoredEventHandler PropertyRestored

Event Value

PropertyRestoredEventHandler

PropertyRestoring

Raised when a property is being restored.

Declaration

cs-api-definition
public event PropertyRestoringEventHandler PropertyRestoring

Event Value

PropertyRestoringEventHandler

PropertyRestoringCompleted

Raised when all properties has been restored.

Declaration

cs-api-definition
public event PropertyRestoringCompletedEventHandler PropertyRestoringCompleted

Event Value

PropertyRestoringCompletedEventHandler

TypeRestored

Occurs when type is restored.

Declaration

cs-api-definition
public event EventHandler<TypeRestoredEventArgs> TypeRestored

Event Value

EventHandler<TypeRestoredEventArgs>