PostSharp6.6//API Reference/Post­Sharp.​Patterns.​Model.​Type­Adapters Namespace/Type­Adapter Class/Type­Adapter Methods/Type­Adapter.​Attach­To­Parent Method

TypeAdapter.AttachToParent Method

Attaches an object to a parent object.

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

Parameters

obj
Type: System.Object
An instance of the adapted type.
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

This method is equivalent to AttachToParent(RelationshipInfo, IAttacher, Object).

Implementations of this method can use the AttachChild(Object, RelationshipInfo, IAttacher, Object) method to attach items to the parent.

See Also