SchemaType Class

A component of Schema that represents one of the child elements, which stands for the class corresponding to the child element, and how the child element occurs inside the parent.

C#
public abstract class SchemaType
Inheritance
SchemaType

Remarks

The SchemaType object is immutable, and has a class annotated with ForElementAttribute corresponding to the child element. It must be created with one of Mandatory.Of<T>(), Optional.Of<T>() and Multiple.Of<T>().

Constructors

SchemaType(Type, bool, bool)

Initializes a new instance of the SchemaType class.

Properties

ElementType

Gets the class corresponding to the child element.

PlaceholderType

Gets the placeholder class corresponding to the child element.

IsMandatory

Gets a value indicating whether the child element always occurs inside the parent.

Methods

ApplyWithContent(XmlReader, Func<Type, Metadata>, Reflector<object>, Action<object>)

Applies the content of the element with the specified action.

ApplyWithEmptyElement(XmlReader, Func<Type, Metadata>, Reflector<object>, Action<object>)

Applies the empty element with the specified action.

Equals(object) (Inherited from object)
GetHashCode() (Inherited from object)
GetType() (Inherited from object)
MemberwiseClone() (Inherited from object)
ToString() (Inherited from object)

See Also

Constructors Detail

SchemaType(Type, bool, bool)

Initializes a new instance of the SchemaType class.

C#
protected SchemaType(Type type, bool isMandatory, bool isMultiple)

Parameters

type
Type

The class corresponding to the child element.

isMandatory
bool

Whether the child element always occurs inside the parent.

isMultiple
bool

Whether the child element occurs zero or multiple times.

Properties Detail

ElementType

Gets the class corresponding to the child element.

C#
public Type ElementType { get; }

Property Value

The class corresponding to the child element.

PlaceholderType

Gets the placeholder class corresponding to the child element.

C#
public Type PlaceholderType { get; }

Property Value

The placeholder class corresponding to the child element.

IsMandatory

Gets a value indicating whether the child element always occurs inside the parent.

C#
public bool IsMandatory { get; }

Property Value

true if the child element always occurs inside the parent.

Methods Detail

ApplyWithContent(XmlReader, Func<Type, Metadata>, Reflector<object>, Action<object>)

Applies the content of the element with the specified action.

C#
public abstract void ApplyWithContent(XmlReader input, Func<Type, Metadata> getMetadata, Reflector<object> reflector, Action<object> setChildValue)

Parameters

input
XmlReader

The XmlReader object.

getMetadata
Func<Type, Metadata>

The function that returns the metadata corresponding to the specified class.

reflector
Reflector<object>

The reflector.

setChildValue
Action<object>

The action to supply a child object to inject.

ApplyWithEmptyElement(XmlReader, Func<Type, Metadata>, Reflector<object>, Action<object>)

Applies the empty element with the specified action.

C#
public abstract void ApplyWithEmptyElement(XmlReader input, Func<Type, Metadata> getMetadata, Reflector<object> reflector, Action<object> setChildValue)

Parameters

input
XmlReader

The XmlReader object.

getMetadata
Func<Type, Metadata>

The function that returns the metadata corresponding to the specified class.

reflector
Reflector<object>

The reflector.

setChildValue
Action<object>

The action to supply a child object to inject.