Class XmlSerializationContext
Denotes the context of a XML deserialization
Inherited Members
Namespace: NMF.Serialization
Assembly: NMF.Serialization.dll
Syntax
public class XmlSerializationContext
Constructors
| Edit this page View SourceXmlSerializationContext(object)
Creates a new context for a deserialization
Declaration
public XmlSerializationContext(object root)
Parameters
Type | Name | Description |
---|---|---|
object | root | The root object |
Properties
| Edit this page View SourceRoot
Gets the deserialization root
Declaration
public object Root { get; }
Property Value
Type | Description |
---|---|
object |
Methods
| Edit this page View SourceBlockProperty(object, IPropertySerializationInfo)
Blocks the given property for the given instance
Declaration
public void BlockProperty(object value, IPropertySerializationInfo property)
Parameters
Type | Name | Description |
---|---|---|
object | value | the instance |
IPropertySerializationInfo | property | the property |
Cleanup()
Ends the deserialization
Declaration
public virtual void Cleanup()
ContainsId(string, ITypeSerializationInfo)
Determines whether the context knows an element of the given id
Declaration
public virtual bool ContainsId(string id, ITypeSerializationInfo type)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id of the element |
ITypeSerializationInfo | type | The expected type of the element |
Returns
Type | Description |
---|---|
bool | True, if the id can be found, otherwise False |
IsBlocked(object, IPropertySerializationInfo)
Determines whether the given property is blocked for the given instance
Declaration
public bool IsBlocked(object instance, IPropertySerializationInfo property)
Parameters
Type | Name | Description |
---|---|---|
object | instance | the instance |
IPropertySerializationInfo | property | the property |
Returns
Type | Description |
---|---|
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
Declaration
protected virtual object OnNameClash(string id, ITypeSerializationInfo type, IEnumerable<object> candidates, object source)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id that was requested |
ITypeSerializationInfo | type | The type |
IEnumerable<object> | candidates | The candidates |
object | source | The source |
Returns
Type | Description |
---|---|
object | The object that should be chosen in the case of a clash |
RegisterId(string, object, ITypeSerializationInfo)
Registers an object for the given id
Declaration
public void RegisterId(string id, object value, ITypeSerializationInfo type)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id that is registered |
object | value | The object that is registered |
ITypeSerializationInfo | type | The type for which the value is registered |
Resolve(string, ITypeSerializationInfo, Type, bool, object)
Resolves the given id
Declaration
public virtual object Resolve(string id, ITypeSerializationInfo type, Type minType = null, bool failOnConflict = true, object source = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id that is resolved |
ITypeSerializationInfo | type | The expected type |
Type | minType | The minimum type that is required |
bool | failOnConflict | If false, the method will return null in case of a conflict, otherwise conflict resolution is applied |
object | source |
Returns
Type | Description |
---|---|
object | The resolved object |