Open sandboxFocus

Class ParentAttribute

Custom attribute that, when applied to a field or automatic property, specifies that this field or property should be automatically set to the parent of the instance of the declaring type, whenever this instance is attached as a child to another object.

Inheritance
ParentAttribute
Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Aggregation.dll
Syntax
public sealed class ParentAttribute : MemberRelationshipAttribute, IValidableAnnotation
Remarks

It is recommended to add this custom attribute only to private fields or automatic properties with a private setter.

User code should not set the field or property. When the parent of the instance is a parent surrogate, such as a child collection, the field or property is set to the owner of the parent surrogate and not to the parent surrogate itself.

The declaring class must have the AggregatableAttribute aspect, applied directly or through another aspect such as a threading model. Otherwise, PostSharp emits a warning.

Constructors

Name Description
ParentAttribute()

See Also