PostSharp6.0/API Reference/Post­Sharp.​Patterns.​Model Namespace/IAttachable Interface/IAttachable Methods/IAttachable.​Attach­To­Parent Method

IAttachable.AttachToParent Method

Attaches the current object to a parent object.

Namespace:  PostSharp.Patterns.Model
Assembly:  PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.0.35.0 (6.0.35.0)
Syntax
C#
bool AttachToParent(
	RelationshipInfo relationshipInfo,
	IAttacher attacher,
	Object attacherState
)

Parameters

relationshipInfo
Type: PostSharp.Patterns.Model.RelationshipInfo
Information about the relationship of the parent node relatively to the current node. The Relationship property must be set to Child or ParentSurrogate.
attacher
Type: PostSharp.Patterns.Model.IAttacher
A service that allows the current node to attach itself to the parent.
attacherState
Type: System.Object
An opaque state object to be passed as the first argument to all methods of the IAttacher interface.

Return Value

Type: Boolean
true if the current object was not previously attached to any parent, false if it was already attached to the same parent.
Remarks

In case a child is attached to its parent through several relationships, all relationships should have the same characteristics, i.e. their RelationshipInfo value should be identical.

See Also