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
rootobjectThe root object
Properties
Root
Gets the deserialization root
public object Root { get; }
Property Value
Methods
BlockProperty(object, IPropertySerializationInfo)
Blocks the given property for the given instance
public void BlockProperty(object value, IPropertySerializationInfo property)
Parameters
valueobjectthe instance
propertyIPropertySerializationInfothe 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
idstringThe id of the element
typeITypeSerializationInfoThe 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
instanceobjectthe instance
propertyIPropertySerializationInfothe 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
idstringThe id that was requested
typeITypeSerializationInfoThe type
candidatesIEnumerable<object>The candidates
sourceobjectThe 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
idstringThe id that is registered
valueobjectThe object that is registered
typeITypeSerializationInfoThe 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
idstringThe id that is resolved
typeITypeSerializationInfoThe expected type
minTypeTypeThe minimum type that is required
failOnConflictboolIf false, the method will return null in case of a conflict, otherwise conflict resolution is applied
sourceobject
Returns
- object
The resolved object