PostSharp 2023.0 / / 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­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: 2023.0.3.0 (2023.0.3.0)
public static bool Advice(
	Object obj,
	RelationshipKind itemsRelationship,
	bool required = true


Type: System.Object
The object into which the impl must be injected.
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