ClassComponentXmlSerializer
Provides XML serialization functionality for components using the same rules as Visual Studio Code DOM serialization.
Definition
Namespace:Telerik.WinControls.XmlSerialization
Assembly:Telerik.WinControls.dll
Syntax:
public class ComponentXmlSerializer
Inheritance: objectComponentXmlSerializer
Derived Classes:
Constructors
ComponentXmlSerializer()
Initializes a new instance of the ComponentXmlSerializer class with default serialization settings.
Declaration
public ComponentXmlSerializer()
ComponentXmlSerializer(ComponentXmlSerializationInfo)
Initializes a new instance of the ComponentXmlSerializer class with extended property serialization information.
Declaration
public ComponentXmlSerializer(ComponentXmlSerializationInfo componentSerializationInfo)
Parameters
componentSerializationInfo
Extended property serialization information for customizing serialization behavior.
ComponentXmlSerializer(IDictionary, ComponentXmlSerializationInfo)
Initializes a new instance of the ComponentXmlSerializer class with custom type mapping and serialization information.
Declaration
public ComponentXmlSerializer(IDictionary typeMap, ComponentXmlSerializationInfo componentSerializationInfo)
Parameters
typeMap
Dictionary mapping type full names to XML element names for custom serialization.
componentSerializationInfo
Extended property serialization information for customizing serialization behavior.
Properties
InstanceFactory
Declaration
public virtual InstanceFactory InstanceFactory { get; set; }
Property Value
PropertiesProvider
Gets or sets the properties provider used for custom property handling during serialization.
Declaration
public IPropertiesProvider PropertiesProvider { get; set; }
Property Value
The properties provider instance.
ResolveTypesOnlyInTelerikAssemblies
Gets or sets a value indicating whether the serializer will search only Telerik assemblies for type resolution.
Declaration
public bool ResolveTypesOnlyInTelerikAssemblies { get; set; }
Property Value
true to search only Telerik assemblies; false to search all domain assemblies.
RootSerializationObject
Gets the root object being serialized or deserialized.
Declaration
public object RootSerializationObject { get; }
Property Value
The root serialization object.
Methods
DisposeObject(IDisposable)
Declaration
protected virtual void DisposeObject(IDisposable toBeDisposed)
Parameters
toBeDisposed
GetCollectionElementOverride(IEnumerable, object, PropertyDescriptor)
Declaration
protected virtual IEnumerable GetCollectionElementOverride(IEnumerable list, object owner, PropertyDescriptor property)
Parameters
list
owner
property
Returns
GetPropertyValue(PropertyDescriptor, object)
Declaration
protected virtual object GetPropertyValue(PropertyDescriptor property, object propertyOwner)
Parameters
property
propertyOwner
Returns
InitializeRead()
Declaration
protected virtual void InitializeRead()
InitializeWrite()
Declaration
protected virtual void InitializeWrite()
MatchExistingItem(XmlReader, IList, object, PropertyDescriptor, string, string, IList, ref int)
Declaration
protected virtual object MatchExistingItem(XmlReader reader, IList toRead, object parent, PropertyDescriptor parentProperty, string propertyToMatch, string uniquePropertyValue, IList existingInstancesToMatch, ref int foundAtIndex)
Parameters
reader
toRead
parent
parentProperty
propertyToMatch
uniquePropertyValue
existingInstancesToMatch
foundAtIndex
Returns
MatchObjectElement(XmlReader, object, PropertyDescriptor, IList, string, IList, out int)
Matches the instance of the element by an attribute value and then deserializes its properties. If the instance is not found in existingInstancesToMatch, new instance of type instanceType will be created and added to existingInstancesToMatch list.
Declaration
protected virtual object MatchObjectElement(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string propertyToMatch, IList existingInstancesToMatch, out int foundAtIndex)
Parameters
reader
parent
parentProperty
toRead
propertyToMatch
existingInstancesToMatch
the list with existing instances
foundAtIndex
index of the element if found in existingInstanceToMatch
Returns
ProcessListOverride(XmlReader, object, PropertyDescriptor, IList)
Override to provide custom processing of collection being deserialized
Declaration
protected virtual bool ProcessListOverride(XmlReader reader, object listOwner, PropertyDescriptor ownerProperty, IList list)
Parameters
reader
listOwner
ownerProperty
list
Returns
True if the list does not require further processing by the deserializer, False to use the default deserialization
ProcessProperty(PropertyDescriptor)
Declaration
protected virtual bool ProcessProperty(PropertyDescriptor property)
Parameters
property
Returns
ProcessReaderAttribute(XmlReader, object, object, PropertyDescriptor)
Reads a property of an object and subobject the reader is currently positioned on.
Declaration
protected virtual bool ProcessReaderAttribute(XmlReader reader, object parentObject, object toRead, PropertyDescriptor property)
Parameters
reader
Xml reader instance, positioned on the element to read.
parentObject
The parent object instance, null if there is no parent object information
toRead
The object instance to be processed
property
The property that is being processed. Extracted from reader.Name
Returns
A value indicating whether the attribute has been processed. If [true] the parent class will not process current property/attribute.
ProcessTypeOverride(Type, XmlReader, PropertyDescriptor, object)
Declaration
protected virtual bool ProcessTypeOverride(Type type, XmlReader reader, PropertyDescriptor property, object toRead)
Parameters
type
reader
property
toRead
Returns
ReadCollectionElement(XmlReader, IList)
Reads a collection element from the XML reader and populates the specified list.
ReadCollectionElement(XmlReader, object, IList)
Reads a collection element from the XML reader and populates the specified list with an owner context.
Declaration
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead)
Parameters
reader
The XML reader positioned at a collection element.
collectionOwner
The object that owns the collection property being deserialized.
toRead
The list to populate with deserialized items.
ReadCollectionElement(XmlReader, object, IList, bool)
Reads a collection element from the XML reader and populates the specified list with disposal options.
Declaration
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead, bool disposeObjects)
Parameters
reader
The XML reader positioned at a collection element.
collectionOwner
The object that owns the collection property being deserialized.
toRead
The list to populate with deserialized items.
disposeObjects
Whether to dispose objects during deserialization.
ReadDictionaryElement(XmlReader, object, IDictionary)
Declaration
protected void ReadDictionaryElement(XmlReader reader, object dictionaryOwner, IDictionary toRead)
Parameters
reader
dictionaryOwner
toRead
ReadElementInObject(XmlReader, PropertyDescriptor, object)
Deserializes a specified property of an object
Declaration
protected virtual void ReadElementInObject(XmlReader reader, PropertyDescriptor property, object toRead)
Parameters
reader
Xml reader, positioned on the element corresponding to the property to deserialize
property
Property descriptor of the property to deserialize
toRead
Object that owns the property to deserialize
ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string)
Reads the collection items if reader is positioned on an element that is a collection.
Declaration
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName)
Parameters
reader
parent
parentProperty
toRead
uniquePropertyName
property used to match objects in collection
ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool)
Reads the collection items if reader is positioned on an element that is a collection.
Declaration
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName, bool disposeObjects)
Parameters
reader
parent
parentProperty
toRead
uniquePropertyName
property used to match objects in collection
disposeObjects
ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool, bool)
if Reader is positioned at an element that is a collection, reads the collection items.
Declaration
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName, bool preserveNotSerializedExistingElements, bool disposeObjects)
Parameters
reader
parent
parentProperty
toRead
uniquePropertyName
property used to match objects in collection
preserveNotSerializedExistingElements
States whether the list specified by toRead should not be cleared before reading
disposeObjects
ReadObjectElement(XmlReader, object)
Reads properties of an object and subobject the reader is currently positioned on.
ReadObjectElement(XmlReader, object, object)
Reads properties of an object and subobject the reader is currently positioned on.
Declaration
public void ReadObjectElement(XmlReader reader, object parentObject, object toRead)
Parameters
reader
Xml reader instance, positioned on the element to read.
parentObject
parent object instance, null if there is no parent object information
toRead
object instance to be processed
ReadObjectElementOverride(XmlReader, object)
Override to provide alternative deserialization of objects.
SetPropertyValue(PropertyDescriptor, object, object)
Declaration
protected virtual void SetPropertyValue(PropertyDescriptor property, object propertyOwner, object value)
Parameters
property
propertyOwner
value
ShouldSerializeValue(object, PropertyDescriptor, PropertySerializationMetadata)
Provides logic to determine whether property value should be serialized.
Declaration
protected virtual bool ShouldSerializeValue(object component, PropertyDescriptor property, PropertySerializationMetadata overwriteMetadata)
Parameters
component
property
property to serialize
overwriteMetadata
collection of extra serialization attributes for the property, corresponding to ComponentSerializationInfo
Returns
value indicating whether property value should be serialized
Remarks
ShouldSerialize value resolution is as follows:
WriteCollectionElement(XmlWriter, IEnumerable, object, PropertyDescriptor)
Declaration
protected virtual void WriteCollectionElement(XmlWriter writer, IEnumerable list, object listOwner, PropertyDescriptor property)
Parameters
writer
list
listOwner
property
WriteCollectionElement(XmlWriter, IEnumerable, string)
Declaration
public void WriteCollectionElement(XmlWriter writer, IEnumerable list, string collectionName)
Parameters
writer
list
collectionName
WriteDictionaryElement(XmlWriter, IDictionary, object, PropertyDescriptor)
Declaration
protected void WriteDictionaryElement(XmlWriter writer, IDictionary toWrite, object listOwner, PropertyDescriptor property)
Parameters
writer
toWrite
listOwner
property
WriteObjectElement(XmlWriter, object)
Serializes the given object using the specified XmlWriter.
WritePropertyOverride(XmlWriter, PropertyDescriptor, object, DesignerSerializationVisibility)
Declaration
protected virtual bool WritePropertyOverride(XmlWriter writer, PropertyDescriptor property, object propertyValue, DesignerSerializationVisibility serializationVisibility)
Parameters
writer
property
propertyValue
serializationVisibility
Returns
WriteTypeAttribute(XmlWriter, Type, object, DesignerSerializationVisibility)
Declaration
protected virtual void WriteTypeAttribute(XmlWriter writer, Type expectedType, object toWrite, DesignerSerializationVisibility serializationVisibility)
Parameters
writer
expectedType
toWrite
serializationVisibility