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. 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. |
Component Extends the properties serialization information. |
ComponentXmlSerializer(ComponentXmlSerializationInfo)
Constructs new instance of the class, providing extended properties serialization information
Declaration
public ComponentXmlSerializer(ComponentXmlSerializationInfo componentSerializationInfo)
Parameters
Component Extends the properties serialization information. |
Properties
InstanceFactory
Declaration
public virtual InstanceFactory InstanceFactory { get; set; }
Property Value
PropertiesProvider
Declaration
public IPropertiesProvider PropertiesProvider { get; set; }
Property Value
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.
|
RootSerializationObject
Declaration
public object RootSerializationObject { get; }
Property Value
System.
|
Methods
DisposeObject(IDisposable)
Declaration
protected virtual void DisposeObject(IDisposable toBeDisposed)
Parameters
System.
|
GetCollectionElementOverride(IEnumerable, Object, PropertyDescriptor)
Declaration
protected virtual IEnumerable GetCollectionElementOverride(IEnumerable list, object owner, PropertyDescriptor property)
Parameters
System.
|
System.
|
System.
|
Returns
System.
|
GetElementNameByType(Type)
Declaration
protected virtual string GetElementNameByType(Type elementType)
Parameters
System.
|
Returns
System.
|
GetPropertyValue(PropertyDescriptor, Object)
Declaration
protected virtual object GetPropertyValue(PropertyDescriptor property, object propertyOwner)
Parameters
System.
|
System.
|
Returns
System.
|
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.
|
System.
|
System.
|
System.
|
System.
|
System.
|
System.
|
System.
|
Returns
System.
|
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.
|
System.
|
System.
|
System.
|
System.
|
System. the list with existing instances |
System. index of the element if found in existingInstanceToMatch |
Returns
System.
|
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.
|
System.
|
System.
|
System.
|
Returns
System. 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.
|
Returns
System.
|
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 reader instance, positioned on the element to read. |
System. The parent object instance, null if there is no parent object information |
System. The object instance to be processed |
System. The property that is being processed. Extracted from reader.Name |
Returns
System. 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.
|
System.
|
System.
|
System.
|
Returns
System.
|
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.
|
System.
|
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.
|
System. object that owns the property (collection) currently deserialized |
System.
|
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.
|
System. object that owns the property (collection) currently deserialized |
System.
|
System.
|
ReadDictionaryElement(XmlReader, Object, IDictionary)
Declaration
protected void ReadDictionaryElement(XmlReader reader, object dictionaryOwner, IDictionary toRead)
Parameters
System.
|
System.
|
System.
|
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 reader, positioned on the element corresponding to the property to deserialize |
System. Property descriptor of the property to deserialize |
System. 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.
|
System.
|
System.
|
System.
|
System. 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.
|
System.
|
System.
|
System.
|
System. property used to match objects in collection |
System.
|
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.
|
System.
|
System.
|
System.
|
System. property used to match objects in collection |
System. States whether the list specified by toRead should not be cleared before reading |
System.
|
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 reader instance, positioned on the element to read. |
System. 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 reader instance, positioned on the element to read. |
System. parent object instance, null if there is no parent object information |
System. 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.
|
System.
|
Returns
System. 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.
|
System.
|
System.
|
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.
|
System. property to serialize |
Property collection of extra serialization attributes for the property, corresponding to ComponentSerializationInfo |
Returns
System. 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.
|
System.
|
System.
|
System.
|
WriteCollectionElement(XmlWriter, IEnumerable, String)
Declaration
public void WriteCollectionElement(XmlWriter writer, IEnumerable list, string collectionName)
Parameters
System.
|
System.
|
System.
|
WriteDictionaryElement(XmlWriter, IDictionary, Object, PropertyDescriptor)
Declaration
protected void WriteDictionaryElement(XmlWriter writer, IDictionary toWrite, object listOwner, PropertyDescriptor property)
Parameters
System.
|
System.
|
System.
|
System.
|
WriteObjectElement(XmlWriter, Object)
Serializes the given object using the specified XmlWriter.
Declaration
public virtual void WriteObjectElement(XmlWriter writer, object toWrite)
Parameters
System.
|
System.
|
WritePropertyOverride(XmlWriter, PropertyDescriptor, Object, DesignerSerializationVisibility)
Declaration
protected virtual bool WritePropertyOverride(XmlWriter writer, PropertyDescriptor property, object propertyValue, DesignerSerializationVisibility serializationVisibility)
Parameters
System.
|
System.
|
System.
|
System.
|
Returns
System.
|
WriteTypeAttribute(XmlWriter, Type, Object, DesignerSerializationVisibility)
Declaration
protected virtual void WriteTypeAttribute(XmlWriter writer, Type expectedType, object toWrite, DesignerSerializationVisibility serializationVisibility)
Parameters
System.
|
System.
|
System.
|
System.
|