PostSharp 6.5 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Model Namespace / Aggregatable­Services Class / Aggregatable­Services Methods / Aggregatable­Services.​Advice Method / Aggregatable­Services.​Advice Method (Object, Relationship­Info, Boolean)

AggregatableServices.Advice Method (Object, RelationshipInfo, Boolean)

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

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

Parameters

obj
Type: System.Object
The object into which the impl must be injected.
relationshipInfo
Type: PostSharp.Patterns.Model.RelationshipInfo
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