PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Dynamic­Advising Namespace / IDynamic­Advice Interface

IDynamicAdvice Interface

Represents an advice that can be injected dynamically into a dynamically-advisable object.

Namespace:  PostSharp.Patterns.DynamicAdvising
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 2023.0.3.0 (2023.0.3.0)
public interface IDynamicAdvice : IDynamicInterfaceImplementation

The IDynamicAdvice type exposes the following members.

Public propertyAdvisedObject
Gets the principal object for which the current object is an indirect interface implementation.
(Inherited from IDynamicInterfaceImplementation.)
Public propertyIdentity
Gets the type identity of the advice, which should correspond to the first parameter of the Advise(Type, Func<IQueryInterface, IDynamicAdvice>) method. This is typically the generic type definition of the advice
Public propertyOrder
Gets the execution order of the dynamic advice. See DynamicAdviceOrder.
Public methodDispose
Disposes the current advice. // We don't use IDisposable so that advises are not be cast to IDisposable by default.
Public methodInitialize
Initializes the current advice.
Public methodQueryInterface<T>
Gets the implementation of an interface.

Dynamic advices form a chain of responsibility. Specific interfaces derived from IDynamicAdvice (e.g. ICollectionDynamicAdvice<T> or IDictionaryDynamicAdvice<TKey, TValue>) define the semantics of the corresponding specific advised type (e.g. AdvisableCollection<T> or AdvisableDictionary<TKey, TValue>. The last node in the chain of implementation is the actual collection implementation.

See Also