Skip to main content
Version: 0.3.x (0.3.0)

Class ValueObjectXmlSerializationAttribute

Namespace: AdCodicem.ValueObjects.Annotations
Assembly: AdCodicem.ValueObjects.Abstractions.dll

Opts every value object of the assembly into XML serialization: the generator implements and a schema provider on each of them.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public sealed class ValueObjectXmlSerializationAttribute : Attribute

Inheritance​

object ← Attribute ← ValueObjectXmlSerializationAttribute

Inherited Members​

Attribute.Equals(object?), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetHashCode(), Attribute.IsDefaultAttribute(), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.Match(object?), Attribute.TypeId, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

XmlSerializer and DataContractSerializer then write a value object as its underlying value, in the form XmlSerializer writes that type in, and read it back through its rules: a value the type refuses fails the read with an carrying the rule's code under . Without it, both write an empty element and read back a default instance.

The schema each serializer exports describes the value object as an xs:simpleType restricting the XSD type of its underlying value, with its rules as facets.

It covers the value objects and the entity identifiers the generator writes in the assembly, but one that implements or declares a schema provider itself, whose implementation stands. A project file sets it with an AssemblyAttribute item whose Include is the full name of this attribute, which the SDK writes into the assembly's attributes.

Properties​

Namespace​

Gets or sets the XML namespace of the schema types the value objects are described with.

public string? Namespace { get; set; }

Property Value​

string?

Remarks​

null, the default, stands for the namespace DataContractSerializer derives from the CLR namespace of each type, which it resolves against http://schemas.datacontract.org/2004/07/ as a relative URI.

A schema type is named after its value object, without the CLR namespace, so a namespace set here puts the value objects of every CLR namespace of the assembly side by side: two of the same name then share one schema type, and the schema provider refuses the second with an when their rules differ, rather than describe it with the rules of the first. Give such value objects distinct names, or leave this unset.