C# Class Catel.Runtime.Serialization.Xml.DataContractSerializerFactory

Default implementation of the IDataContractSerializerFactory interface.
Inheritance: IDataContractSerializerFactory
Show file Open project: Catel/Catel

Public Methods

Method Description
DataContractSerializerFactory ( ) : System

Initializes a new instance of the DataContractSerializerFactory class.

GetDataContractSerializer ( Type serializingType, Type typeToSerialize, string xmlName, string rootNamespace = null, List additionalKnownTypes = null ) : DataContractSerializer

Gets the Data Contract serializer for a specific type. This method caches serializers so the performance can be improved when a serializer is used more than once.

Protected Methods

Method Description
AddTypeToKnownTypesIfSerializable ( Type typeToAdd, XmlSerializerTypeInfo serializerTypeInfo ) : bool

Adds the type to the known types if the type is serializable.

AllowNonPublicReflection ( Type type ) : bool

Returns whether non-public reflection is allowed on the specified type.

GetKnownTypes ( Type type, XmlSerializerTypeInfo serializerTypeInfo, bool resolveAbstractClassesAndInterfaces = true ) : void

Gets the known types inside the specific type.

GetKnownTypesViaAttributes ( Type type ) : System.Type[]

Gets the known types via attributes.

IsTypeSerializable ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : bool

Determines whether the specified type is serializable.

ShouldTypeBeIgnored ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : bool

Determines whether the type should be handled.

Private Methods

Method Description
AddTypeMembers ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : void
GetDataContractSerializer ( Type serializingType, Type typeToSerialize, string xmlName, string rootNamespace, object serializingObject, List additionalKnownTypes = null ) : DataContractSerializer
GetKnownTypesForInstance ( object obj, XmlSerializerTypeInfo serializerTypeInfo ) : void
GetKnownTypesForItems ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : void

Gets the known types of IEnumerable type.

GetKnownTypesForItemsInstance ( object obj, XmlSerializerTypeInfo serializerTypeInfo ) : void

Method Details

AddTypeToKnownTypesIfSerializable() protected method

Adds the type to the known types if the type is serializable.
protected AddTypeToKnownTypesIfSerializable ( Type typeToAdd, XmlSerializerTypeInfo serializerTypeInfo ) : bool
typeToAdd System.Type The type to add.
serializerTypeInfo XmlSerializerTypeInfo The serializer type info.
return bool

AllowNonPublicReflection() protected method

Returns whether non-public reflection is allowed on the specified type.
protected AllowNonPublicReflection ( Type type ) : bool
type System.Type The type.
return bool

DataContractSerializerFactory() public method

Initializes a new instance of the DataContractSerializerFactory class.
public DataContractSerializerFactory ( ) : System
return System

GetDataContractSerializer() public method

Gets the Data Contract serializer for a specific type. This method caches serializers so the performance can be improved when a serializer is used more than once.
The is null. The is null. The is null or whitespace.
public GetDataContractSerializer ( Type serializingType, Type typeToSerialize, string xmlName, string rootNamespace = null, List additionalKnownTypes = null ) : DataContractSerializer
serializingType System.Type The type that is currently (de)serializing.
typeToSerialize System.Type The type to (de)serialize.
xmlName string Name of the property as known in XML.
rootNamespace string The root namespace.
additionalKnownTypes List A list of additional types to add to the known types.
return System.Runtime.Serialization.DataContractSerializer

GetKnownTypes() protected method

Gets the known types inside the specific type.
protected GetKnownTypes ( Type type, XmlSerializerTypeInfo serializerTypeInfo, bool resolveAbstractClassesAndInterfaces = true ) : void
type System.Type The type.
serializerTypeInfo XmlSerializerTypeInfo The serializer type info.
resolveAbstractClassesAndInterfaces bool if set to true [resolve abstract classes and interfaces].
return void

GetKnownTypesViaAttributes() protected method

Gets the known types via attributes.
The is null.
protected GetKnownTypesViaAttributes ( Type type ) : System.Type[]
type System.Type The type.
return System.Type[]

IsTypeSerializable() protected method

Determines whether the specified type is serializable.
protected IsTypeSerializable ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : bool
type System.Type The type.
serializerTypeInfo XmlSerializerTypeInfo The serializer type information.
return bool

ShouldTypeBeIgnored() protected method

Determines whether the type should be handled.
protected ShouldTypeBeIgnored ( Type type, XmlSerializerTypeInfo serializerTypeInfo ) : bool
type System.Type The type.
serializerTypeInfo XmlSerializerTypeInfo The serializer type info.
return bool