Custom attribute that, when applied to a class, implements the IDisposable in such a way that the Dispose() method executes the Dispose() method for all children objects that also implement the IDisposable interface.
Inheritance
Implements
Namespace: PostSharp.Patterns.Model
Assembly: PostSharp.Patterns.Model.dll
Syntax
[IntroduceInterface(typeof(IDisposable), OverrideAction = InterfaceOverrideAction.Ignore)]
[MulticastAttributeUsage(Inheritance = MulticastInheritance.Strict)]
[Serializer(typeof(DisposableAttribute.Serializer))]
public sealed class DisposableAttribute : AggregatableClientAttribute, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IAspectProvider, IService, IAdviceProvider, IAspect, IDisposable
Constructors
Name | Description |
---|---|
DisposableAttribute() | |
DisposableAttribute(PortableFormatterConstructorContext) |
Properties
Name | Description |
---|---|
ThrowObjectDisposedException | Determines whether an ObjectDisposedException should be thrown when an attempt is made to access an object that has already been disposed. |
Methods
Name | Description |
---|---|
Advise(object) | Injects the advice into the child object. |
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 ( |