Open sandboxFocus

Class ThreadAwareAttribute

Base class for all aspects implementing threading models.

Namespace: PostSharp.Patterns.Threading
Assembly: PostSharp.Patterns.Threading.dll
Syntax
[ProvideAspectRole("ThreadingModel")]
[ProvideAspectRole("Threading")]
[AspectRoleDependency(AspectDependencyAction.Conflict, "ThreadingModel")]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, "Tracing")]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, "Validation")]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.Before, "Caching")]
[AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.Before, "CacheInvalidation")]
[MulticastAttributeUsage(Inheritance = MulticastInheritance.Strict, AllowMultiple = false, PersistMetaData = true)]
[IntroduceInterface(typeof(IThreadAware), OverrideAction = InterfaceOverrideAction.Ignore)]
[IntroduceInterface(typeof(IThreadAwareImplementationProvider), OverrideAction = InterfaceOverrideAction.Ignore)]
[IntroduceInterface(typeof(IQueryInterface), OverrideAction = InterfaceOverrideAction.Ignore, AncestorOverrideAction = InterfaceOverrideAction.Ignore)]
[Serializer(typeof(ThreadAwareAttribute.Serializer))]
public abstract class ThreadAwareAttribute : AggregatableClientAttribute, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IAspectProvider, IService, IAdviceProvider, IAspect, IThreadAware, IQueryInterface

Constructors

Name Description
ThreadAwareAttribute(PortableFormatterConstructorContext)

Properties

Name Description
RuntimeVerificationEnabled

Determines whether the code should be verified against the model at runtime. The default value is true for the debug build configuration and false for the release build configuration.

Methods

Name Description
Advise(object)

Injects the advice into the child object.

CompileTimeValidate(Type)

Method invoked at build time to ensure that the aspect has been applied to the right target.

Finalize()

Destructor.

IsEligibleChild(object, ChildInfo)

Determines if an object is eligible to be a child of the target instance of the current aspect.

OnAdviseChildFailed(object)

Method invoked when a child is assigned to a parent and the advices of the parent cannot be added to the child. Implementations can choose to throw an exception (thread-aware attributes do this) or ignore the situation (DisposableAttribute does this).

OnSerializing(StreamingContext)

Requires read access level to the current object before serialization can proceed. This method will be introduced into the target class.