Class ComponentXmlSerializer
Serializes components to XML, using the same rules that apply in Code Dom serialization, in VS designer.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.XmlSerialization
Assembly: Telerik.WinControls.dll
Syntax
public class ComponentXmlSerializer
Constructors
ComponentXmlSerializer()
Declaration
public ComponentXmlSerializer()
ComponentXmlSerializer(IDictionary, ComponentXmlSerializationInfo)
Constructs new instance of the class, providing extended serialization information.
Declaration
public ComponentXmlSerializer(IDictionary typeMap, ComponentXmlSerializationInfo componentSerializationInfo)
Parameters
System.Collections.IDictionary
typeMap
Dictionary to use that maps type names to XML element names. Keys of the dictionary entries should be type full names. Values should correspond to the type instances. |
ComponentXmlSerializationInfo
componentSerializationInfo
Extends the properties serialization information. |
ComponentXmlSerializer(ComponentXmlSerializationInfo)
Constructs new instance of the class, providing extended properties serialization information
Declaration
public ComponentXmlSerializer(ComponentXmlSerializationInfo componentSerializationInfo)
Parameters
ComponentXmlSerializationInfo
componentSerializationInfo
Extends the properties serialization information. |
Properties
InstanceFactory
Declaration
public virtual InstanceFactory InstanceFactory { get; set; }
Property Value
InstanceFactory
|
PropertiesProvider
Declaration
public IPropertiesProvider PropertiesProvider { get; set; }
Property Value
IPropertiesProvider
|
ResolveTypesOnlyInTelerikAssemblies
Gets or sets value indicating whether the serializer will search all domain assemblies for a specified type (by FullName) or will search only assemblies related to telerik
Declaration
public bool ResolveTypesOnlyInTelerikAssemblies { get; set; }
Property Value
System.Boolean
|
RootSerializationObject
Declaration
public object RootSerializationObject { get; }
Property Value
System.Object
|
Methods
DisposeObject(IDisposable)
Declaration
protected virtual void DisposeObject(IDisposable toBeDisposed)
Parameters
System.IDisposable
toBeDisposed
|
GetCollectionElementOverride(IEnumerable, Object, PropertyDescriptor)
Declaration
protected virtual IEnumerable GetCollectionElementOverride(IEnumerable list, object owner, PropertyDescriptor property)
Parameters
System.Collections.IEnumerable
list
|
System.Object
owner
|
System.ComponentModel.PropertyDescriptor
property
|
Returns
System.Collections.IEnumerable
|
GetElementNameByType(Type)
Declaration
protected virtual string GetElementNameByType(Type elementType)
Parameters
System.Type
elementType
|
Returns
System.String
|
GetPropertyValue(PropertyDescriptor, Object)
Declaration
protected virtual object GetPropertyValue(PropertyDescriptor property, object propertyOwner)
Parameters
System.ComponentModel.PropertyDescriptor
property
|
System.Object
propertyOwner
|
Returns
System.Object
|
InitializeRead()
Declaration
protected virtual void InitializeRead()
InitializeWrite()
Declaration
protected virtual void InitializeWrite()
MatchExistingItem(XmlReader, IList, Object, PropertyDescriptor, String, String, IList, ref Int32)
Declaration
protected virtual object MatchExistingItem(XmlReader reader, IList toRead, object parent, PropertyDescriptor parentProperty, string propertyToMatch, string uniquePropertyValue, IList existingInstancesToMatch, ref int foundAtIndex)
Parameters
System.Xml.XmlReader
reader
|
System.Collections.IList
toRead
|
System.Object
parent
|
System.ComponentModel.PropertyDescriptor
parentProperty
|
System.String
propertyToMatch
|
System.String
uniquePropertyValue
|
System.Collections.IList
existingInstancesToMatch
|
System.Int32
foundAtIndex
|
Returns
System.Object
|
MatchObjectElement(XmlReader, Object, PropertyDescriptor, IList, String, IList, out Int32)
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
System.Xml.XmlReader
reader
|
System.Object
parent
|
System.ComponentModel.PropertyDescriptor
parentProperty
|
System.Collections.IList
toRead
|
System.String
propertyToMatch
|
System.Collections.IList
existingInstancesToMatch
the list with existing instances |
System.Int32
foundAtIndex
index of the element if found in existingInstanceToMatch |
Returns
System.Object
|
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
System.Xml.XmlReader
reader
|
System.Object
listOwner
|
System.ComponentModel.PropertyDescriptor
ownerProperty
|
System.Collections.IList
list
|
Returns
System.Boolean
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
System.ComponentModel.PropertyDescriptor
property
|
Returns
System.Boolean
|
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
System.Xml.XmlReader
reader
Xml reader instance, positioned on the element to read. |
System.Object
parentObject
The parent object instance, null if there is no parent object information |
System.Object
toRead
The object instance to be processed |
System.ComponentModel.PropertyDescriptor
property
The property that is being processed. Extracted from reader.Name |
Returns
System.Boolean
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
System.Type
type
|
System.Xml.XmlReader
reader
|
System.ComponentModel.PropertyDescriptor
property
|
System.Object
toRead
|
Returns
System.Boolean
|
ReadCollectionElement(XmlReader, IList)
if Reader is positioned at an element that is a collection, reads the collection items.
Declaration
public void ReadCollectionElement(XmlReader reader, IList toRead)
Parameters
System.Xml.XmlReader
reader
|
System.Collections.IList
toRead
|
ReadCollectionElement(XmlReader, Object, IList)
if Reader is positioned at an element that is a collection, reads the collection items.
Declaration
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead)
Parameters
System.Xml.XmlReader
reader
|
System.Object
collectionOwner
object that owns the property (collection) currently deserialized |
System.Collections.IList
toRead
|
ReadCollectionElement(XmlReader, Object, IList, Boolean)
if Reader is positioned at an element that is a collection, reads the collection items.
Declaration
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead, bool disposeObjects)
Parameters
System.Xml.XmlReader
reader
|
System.Object
collectionOwner
object that owns the property (collection) currently deserialized |
System.Collections.IList
toRead
|
System.Boolean
disposeObjects
|
ReadDictionaryElement(XmlReader, Object, IDictionary)
Declaration
protected void ReadDictionaryElement(XmlReader reader, object dictionaryOwner, IDictionary toRead)
Parameters
System.Xml.XmlReader
reader
|
System.Object
dictionaryOwner
|
System.Collections.IDictionary
toRead
|
ReadElementInObject(XmlReader, PropertyDescriptor, Object)
Deserializes a specified property of an object
Declaration
protected virtual void ReadElementInObject(XmlReader reader, PropertyDescriptor property, object toRead)
Parameters
System.Xml.XmlReader
reader
Xml reader, positioned on the element corresponding to the property to deserialize |
System.ComponentModel.PropertyDescriptor
property
Property descriptor of the property to deserialize |
System.Object
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
System.Xml.XmlReader
reader
|
System.Object
parent
|
System.ComponentModel.PropertyDescriptor
parentProperty
|
System.Collections.IList
toRead
|
System.String
uniquePropertyName
property used to match objects in collection |
ReadMergeCollection(XmlReader, Object, PropertyDescriptor, IList, String, Boolean)
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
System.Xml.XmlReader
reader
|
System.Object
parent
|
System.ComponentModel.PropertyDescriptor
parentProperty
|
System.Collections.IList
toRead
|
System.String
uniquePropertyName
property used to match objects in collection |
System.Boolean
disposeObjects
|
ReadMergeCollection(XmlReader, Object, PropertyDescriptor, IList, String, Boolean, Boolean)
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
System.Xml.XmlReader
reader
|
System.Object
parent
|
System.ComponentModel.PropertyDescriptor
parentProperty
|
System.Collections.IList
toRead
|
System.String
uniquePropertyName
property used to match objects in collection |
System.Boolean
preserveNotSerializedExistingElements
States whether the list specified by toRead should not be cleared before reading |
System.Boolean
disposeObjects
|
ReadObjectElement(XmlReader, Object)
Reads properties of an object and subobject the reader is currently positioned on.
Declaration
public void ReadObjectElement(XmlReader reader, object toRead)
Parameters
System.Xml.XmlReader
reader
Xml reader instance, positioned on the element to read. |
System.Object
toRead
object instance to be processed |
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
System.Xml.XmlReader
reader
Xml reader instance, positioned on the element to read. |
System.Object
parentObject
parent object instance, null if there is no parent object information |
System.Object
toRead
object instance to be processed |
ReadObjectElementOverride(XmlReader, Object)
Override to provide alternative deserialization of objects.
Declaration
protected virtual bool ReadObjectElementOverride(XmlReader reader, object toRead)
Parameters
System.Xml.XmlReader
reader
|
System.Object
toRead
|
Returns
System.Boolean
value indicating whether the object should be processed any further by serializer |
SetPropertyValue(PropertyDescriptor, Object, Object)
Declaration
protected virtual void SetPropertyValue(PropertyDescriptor property, object propertyOwner, object value)
Parameters
System.ComponentModel.PropertyDescriptor
property
|
System.Object
propertyOwner
|
System.Object
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
System.Object
component
|
System.ComponentModel.PropertyDescriptor
property
property to serialize |
PropertySerializationMetadata
overwriteMetadata
collection of extra serialization attributes for the property, corresponding to ComponentSerializationInfo |
Returns
System.Boolean
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
System.Xml.XmlWriter
writer
|
System.Collections.IEnumerable
list
|
System.Object
listOwner
|
System.ComponentModel.PropertyDescriptor
property
|
WriteCollectionElement(XmlWriter, IEnumerable, String)
Declaration
public void WriteCollectionElement(XmlWriter writer, IEnumerable list, string collectionName)
Parameters
System.Xml.XmlWriter
writer
|
System.Collections.IEnumerable
list
|
System.String
collectionName
|
WriteDictionaryElement(XmlWriter, IDictionary, Object, PropertyDescriptor)
Declaration
protected void WriteDictionaryElement(XmlWriter writer, IDictionary toWrite, object listOwner, PropertyDescriptor property)
Parameters
System.Xml.XmlWriter
writer
|
System.Collections.IDictionary
toWrite
|
System.Object
listOwner
|
System.ComponentModel.PropertyDescriptor
property
|
WriteObjectElement(XmlWriter, Object)
Serializes the given object using the specified XmlWriter.
Declaration
public virtual void WriteObjectElement(XmlWriter writer, object toWrite)
Parameters
System.Xml.XmlWriter
writer
|
System.Object
toWrite
|
WritePropertyOverride(XmlWriter, PropertyDescriptor, Object, DesignerSerializationVisibility)
Declaration
protected virtual bool WritePropertyOverride(XmlWriter writer, PropertyDescriptor property, object propertyValue, DesignerSerializationVisibility serializationVisibility)
Parameters
System.Xml.XmlWriter
writer
|
System.ComponentModel.PropertyDescriptor
property
|
System.Object
propertyValue
|
System.ComponentModel.DesignerSerializationVisibility
serializationVisibility
|
Returns
System.Boolean
|
WriteTypeAttribute(XmlWriter, Type, Object, DesignerSerializationVisibility)
Declaration
protected virtual void WriteTypeAttribute(XmlWriter writer, Type expectedType, object toWrite, DesignerSerializationVisibility serializationVisibility)
Parameters
System.Xml.XmlWriter
writer
|
System.Type
expectedType
|
System.Object
toWrite
|
System.ComponentModel.DesignerSerializationVisibility
serializationVisibility
|