PostSharp6.5//API Reference/Post­Sharp.​Patterns.​Model Namespace/Aggregatable­Services Class/Aggregatable­Services Methods/Aggregatable­Services.​Advice Method/Aggregatable­Services.​Advice Method (Object, Relationship­Kind, Boolean)

AggregatableServices.Advice Method (Object, RelationshipKind, Boolean)

Injects the Aggregatable dynamic impl into an object and specifies the RelationshipKind.

Namespace:  PostSharp.Patterns.Model
Assembly:  PostSharp.Patterns.Aggregation (in PostSharp.Patterns.Aggregation.dll) Version: 6.5.13.0 (6.5.13.0)
Syntax
C#
public static bool Advice(
	Object obj,
	RelationshipKind itemsRelationship,
	bool required = true
)

Parameters

obj
Type: System.Object
The object into which the impl must be injected.
itemsRelationship
Type: PostSharp.Patterns.Model.RelationshipKind
The description of the relationship of obj relatively to its parent.
required (Optional)
Type: System.Boolean
true if an InvalidOperationException should be thrown in case obj cannot be dynamically advised, otherwise false.

Return Value

Type: Boolean
true if the Aggregatable impl was successfully injected into obj, false if obj already implemented the impl, or if obj cannot be dynamically advised and required is false.
See Also