Including CLR Objects in Configuration
PostSharp includes a basic facility to describe CLR objects using XML. This facility is used to implement the Specific rules for the Multicast section and loggingprofiles sections of the configuration file, and can be used to define custom sections.
The facility is consciously limited in features. It was only designed to provide the same features as custom attributes in programming languages.
The basic rules apply to XML serialized objects:
The local name of the XML element must exactly match the type name of the CLR type. An exception to this rule is that the
Attributeprefix can be omitted.
The XML namespace of the element must be in the form
clr-namespace:namespace;assembly:assemblywhere namespace is the namespace of the CLR type and assembly is the name of the assembly declaring the type.
The type must have a public parameterless constructor.
Names of XML attributes must exactly match the name of a public field or property of the CLR type.
Formatting of attributes
Values of XML attributes, mapping to CLR fields and properties, must be formatted according to the rule relevant for each type:
|Intrinsics||An intrinsic is any of the following types:
|Arrays||A semicolon-separated list of elements.|
|Enumerations||A list of enumeration member names separated by characters `|
|Types||An assembly-qualified type name.|
|Object||Fields and properties of type Object are not supported.|
Specific rules for the Multicast section
The following additional rules apply to the Configuration File Schema Reference section of the configuration file: