Open sandboxFocus

Class FieldRule

Exposes the GetRelationshipInfo(FieldInfo) method, which makes it possible to mark a field as Child or Reference programmatically, without a custom attribute.

Inheritance
FieldRule
Namespace: PostSharp.Patterns.Model.TypeAdapters
Assembly: PostSharp.Patterns.Aggregation.dll
Syntax
public abstract class FieldRule
Remarks

Field rules must be registered using the RegisterFieldRuleAttribute custom attribute.

Use a field rule when fields cannot be annotated, for example fields generated by a designer, or when annotating many fields one by one is not practical. At build time, the AggregatableAttribute aspect calls GetRelationshipInfo(FieldInfo) for each field that has no ChildAttribute, ReferenceAttribute or ParentAttribute custom attribute and whose type requires one. The first rule that returns a non-null value determines the relationship. PostSharp has built-in rules, evaluated before the registered ones, that mark as references the fields generated for Windows Forms controls and XAML elements.

Constructors

Name Description
FieldRule()

Methods

Name Description
GetRelationshipInfo(FieldInfo)

Gets the RelationshipInfo of a given field.

See Also