C# Class Tp.Integration.Messages.ServiceBus.Serialization.XmlDeserializer

Deserializes complex objects serialized with the XmlSerializer.
Inheritance: IDisposable
显示文件 Open project: TargetProcess/Target-Process-Plugins Class Usage Examples

Private Properties

Property Type Description
CreateArrayInstance System.Array
CreateInstance object
GetObjectInfo ObjectInfo
TranslateTypeByKey TypeInfo

Public Methods

Method Description
Deserialize ( XmlDocument document ) : object

Deserialzes an object from XmlDocument.

Deserialize ( XmlNode node ) : object

Deserializes an Object from the specified XmlNode.

Deserialize ( string filename ) : object

Deserialzes an object from a xml file.

Dispose ( ) : void

Dispose, release references.

RegisterAssemblies ( Assembly assemblies ) : int

Registers a list of assemblies.

RegisterAssemblies ( List assemblies ) : int

Registers a list of assemblies.

RegisterAssembly ( Assembly assembly ) : void

Registers an Assembly.

Register Assemblies which are not known at compile time, e.g. PlugIns or whatever.

Reset ( ) : void

Clears the typedictionary collection.

XmlDeserializer ( ) : System
XmlDeserializer ( Action typeNotFoundAction ) : System

Protected Methods

Method Description
AddAssemblyRegisterToCache ( ) : void

Adds the assembly register items to the assembly cache.

CreateType ( String assembly, string type ) : Type

Creates a type from the specified assembly and type names. In case of failure null will be returned.

CreateType ( TypeInfo info ) : Type

Creates a type from the specified assembly and type names included in the TypeInfo parameter. In case of failure null will be returned.

GetArrayLength ( XmlNode parent ) : int

Returns the length of the array of a arry-XmlNode.

GetAssembly ( String assembly ) : Assembly

GetAttributeValue ( XmlNode node, string name ) : string

Returns the value or the attribute with the specified name from the given node if it is not null or empty.

GetBinaryConstructorType ( XmlNode node ) : TypeInfo

GetConverter ( Type type ) : TypeConverter

Returns the TypeConverter of a Type.

GetObject ( XmlNode node ) : object

Creates an instance by the contents of the given XmlNode.

GetProperties ( object parent, XmlNode node ) : void

Reads the properties of the specified node and sets them an the parent object.

This is the central method which is called recursivly!

HasBinaryConstructor ( XmlNode node ) : bool

ParseTypeDictionary ( XmlNode parentNode ) : Hashtable

Parses the TypeDictionary (if given).

The TypeDictionary is Hashtable in which TypeInfo items are stored.

SetCollectionValues ( ICollection coll, XmlNode parentNode ) : void

Sets the entries on an ICollection implementation.

SetDictionaryValues ( IDictionary dictionary, XmlNode parentNode ) : void

Sets the entries of an IDictionary implementation.

SetListValues ( IList list, XmlNode parentNode ) : void

Sets the entries on an IList implementation.

Private Methods

Method Description
CreateArrayInstance ( ObjectInfo info, int length ) : Array

Creates an instance of an Array by the specified ObjectInfo.

CreateInstance ( ObjectInfo info ) : object

Creates an instance by the specified ObjectInfo.

GetObjectInfo ( XmlNode node ) : ObjectInfo

Gets an ObjectInfo instance by the attributes of the specified XmlNode.

TranslateTypeByKey ( String key ) : TypeInfo

Method Details

AddAssemblyRegisterToCache() protected method

Adds the assembly register items to the assembly cache.
protected AddAssemblyRegisterToCache ( ) : void
return void

CreateType() protected method

Creates a type from the specified assembly and type names. In case of failure null will be returned.
protected CreateType ( String assembly, string type ) : Type
assembly String
type string
return System.Type

CreateType() protected method

Creates a type from the specified assembly and type names included in the TypeInfo parameter. In case of failure null will be returned.
protected CreateType ( TypeInfo info ) : Type
info TypeInfo
return System.Type

Deserialize() public method

Deserialzes an object from XmlDocument.
public Deserialize ( XmlDocument document ) : object
document System.Xml.XmlDocument
return object

Deserialize() public method

Deserializes an Object from the specified XmlNode.
public Deserialize ( XmlNode node ) : object
node System.Xml.XmlNode
return object

Deserialize() public method

Deserialzes an object from a xml file.
public Deserialize ( string filename ) : object
filename string
return object

Dispose() public method

Dispose, release references.
public Dispose ( ) : void
return void

GetArrayLength() protected method

Returns the length of the array of a arry-XmlNode.
protected GetArrayLength ( XmlNode parent ) : int
parent System.Xml.XmlNode
return int

GetAssembly() protected method

protected GetAssembly ( String assembly ) : Assembly
assembly String
return System.Reflection.Assembly

GetAttributeValue() protected method

Returns the value or the attribute with the specified name from the given node if it is not null or empty.
protected GetAttributeValue ( XmlNode node, string name ) : string
node System.Xml.XmlNode
name string
return string

GetBinaryConstructorType() protected method

protected GetBinaryConstructorType ( XmlNode node ) : TypeInfo
node System.Xml.XmlNode
return TypeInfo

GetConverter() protected method

Returns the TypeConverter of a Type.
protected GetConverter ( Type type ) : TypeConverter
type System.Type
return System.ComponentModel.TypeConverter

GetObject() protected method

Creates an instance by the contents of the given XmlNode.
protected GetObject ( XmlNode node ) : object
node System.Xml.XmlNode
return object

GetProperties() protected method

Reads the properties of the specified node and sets them an the parent object.
This is the central method which is called recursivly!
protected GetProperties ( object parent, XmlNode node ) : void
parent object
node System.Xml.XmlNode
return void

HasBinaryConstructor() protected method

protected HasBinaryConstructor ( XmlNode node ) : bool
node System.Xml.XmlNode
return bool

ParseTypeDictionary() protected method

Parses the TypeDictionary (if given).
The TypeDictionary is Hashtable in which TypeInfo items are stored.
protected ParseTypeDictionary ( XmlNode parentNode ) : Hashtable
parentNode System.Xml.XmlNode
return System.Collections.Hashtable

RegisterAssemblies() public method

Registers a list of assemblies.
public RegisterAssemblies ( Assembly assemblies ) : int
assemblies System.Reflection.Assembly
return int

RegisterAssemblies() public method

Registers a list of assemblies.
public RegisterAssemblies ( List assemblies ) : int
assemblies List
return int

RegisterAssembly() public method

Registers an Assembly.
Register Assemblies which are not known at compile time, e.g. PlugIns or whatever.
public RegisterAssembly ( Assembly assembly ) : void
assembly System.Reflection.Assembly
return void

Reset() public method

Clears the typedictionary collection.
public Reset ( ) : void
return void

SetCollectionValues() protected method

Sets the entries on an ICollection implementation.
protected SetCollectionValues ( ICollection coll, XmlNode parentNode ) : void
coll ICollection
parentNode System.Xml.XmlNode
return void

SetDictionaryValues() protected method

Sets the entries of an IDictionary implementation.
protected SetDictionaryValues ( IDictionary dictionary, XmlNode parentNode ) : void
dictionary IDictionary
parentNode System.Xml.XmlNode
return void

SetListValues() protected method

Sets the entries on an IList implementation.
protected SetListValues ( IList list, XmlNode parentNode ) : void
list IList
parentNode System.Xml.XmlNode
return void

XmlDeserializer() public method

public XmlDeserializer ( ) : System
return System

XmlDeserializer() public method

public XmlDeserializer ( Action typeNotFoundAction ) : System
typeNotFoundAction Action
return System