Table of Contents

Class XmlSerializationContext

Namespace
NMF.Serialization
Assembly
NMF.Serialization.dll

Denotes the context of a XML deserialization

public class XmlSerializationContext
Inheritance
XmlSerializationContext
Derived
Inherited Members

Constructors

XmlSerializationContext(object)

Creates a new context for a deserialization

public XmlSerializationContext(object root)

Parameters

root object

The root object

Properties

Root

Gets the deserialization root

public object Root { get; }

Property Value

object

Methods

BlockProperty(object, IPropertySerializationInfo)

Blocks the given property for the given instance

public void BlockProperty(object value, IPropertySerializationInfo property)

Parameters

value object

the instance

property IPropertySerializationInfo

the property

Cleanup()

Ends the deserialization

public virtual void Cleanup()

ContainsId(string, ITypeSerializationInfo)

Determines whether the context knows an element of the given id

public virtual bool ContainsId(string id, ITypeSerializationInfo type)

Parameters

id string

The id of the element

type ITypeSerializationInfo

The expected type of the element

Returns

bool

True, if the id can be found, otherwise False

IsBlocked(object, IPropertySerializationInfo)

Determines whether the given property is blocked for the given instance

public bool IsBlocked(object instance, IPropertySerializationInfo property)

Parameters

instance object

the instance

property IPropertySerializationInfo

the property

Returns

bool

True, if the property is blocked, which means that it should be ignored for the deserialization

OnNameClash(string, ITypeSerializationInfo, IEnumerable<object>, object)

Gets called when there is a name clash

protected virtual object OnNameClash(string id, ITypeSerializationInfo type, IEnumerable<object> candidates, object source)

Parameters

id string

The id that was requested

type ITypeSerializationInfo

The type

candidates IEnumerable<object>

The candidates

source object

The source

Returns

object

The object that should be chosen in the case of a clash

RegisterId(string, object, ITypeSerializationInfo)

Registers an object for the given id

public void RegisterId(string id, object value, ITypeSerializationInfo type)

Parameters

id string

The id that is registered

value object

The object that is registered

type ITypeSerializationInfo

The type for which the value is registered

Resolve(string, ITypeSerializationInfo, Type, bool, object)

Resolves the given id

public virtual object Resolve(string id, ITypeSerializationInfo type, Type minType = null, bool failOnConflict = true, object source = null)

Parameters

id string

The id that is resolved

type ITypeSerializationInfo

The expected type

minType Type

The minimum type that is required

failOnConflict bool

If false, the method will return null in case of a conflict, otherwise conflict resolution is applied

source object

Returns

object

The resolved object