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
objectThe 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
value
objectthe instance
property
IPropertySerializationInfothe 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
stringThe id of the element
type
ITypeSerializationInfoThe 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
objectthe instance
property
IPropertySerializationInfothe 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
stringThe id that was requested
type
ITypeSerializationInfoThe type
candidates
IEnumerable<object>The candidates
source
objectThe 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
stringThe id that is registered
value
objectThe object that is registered
type
ITypeSerializationInfoThe 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
stringThe id that is resolved
type
ITypeSerializationInfoThe expected type
minType
TypeThe minimum type that is required
failOnConflict
boolIf false, the method will return null in case of a conflict, otherwise conflict resolution is applied
source
object
Returns
- object
The resolved object