Custom attribute that, when applied to a method defined in the current assembly, inserts a piece
of code before and after the body of these methods. This custom attribute can be multicasted
(see MulticastAttribute).
Namespace:
PostSharp.LaosAssembly: PostSharp.Laos (in PostSharp.Laos.dll)
Syntax
| Visual Basic (Declaration) |
|---|
<SerializableAttribute> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Constructor Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Event, AllowMultiple := True, _ Inherited := False)> _ <MulticastAttributeUsageAttribute(MulticastTargets.Default Or MulticastTargets.Method Or MulticastTargets.Constructor, AllowMultiple := True, _ TargetMemberAttributes := MulticastAttributes.Default Or MulticastAttributes.Private Or MulticastAttributes.Protected Or MulticastAttributes.Internal Or MulticastAttributes.InternalAndProtected Or MulticastAttributes.InternalOrProtected Or MulticastAttributes.Public Or MulticastAttributes.AnyVisibility Or MulticastAttributes.Static Or MulticastAttributes.Instance Or MulticastAttributes.AnyScope Or MulticastAttributes.NonAbstract Or MulticastAttributes.Managed)> _ Public MustInherit Class OnMethodBoundaryAspect _ Inherits ExceptionHandlerAspect _ Implements IOnMethodBoundaryAspect, IExceptionHandlerAspect, ILaosMethodLevelAspect, ILaosWeavableAspect, _ IInstanceBoundLaosAspect, ILaosAspect |
| C# |
|---|
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event, AllowMultiple = true, Inherited = false)] [MulticastAttributeUsageAttribute(MulticastTargets.Default|MulticastTargets.Method|MulticastTargets.Constructor, AllowMultiple = true, TargetMemberAttributes = MulticastAttributes.Default|MulticastAttributes.Private|MulticastAttributes.Protected|MulticastAttributes.Internal|MulticastAttributes.InternalAndProtected|MulticastAttributes.InternalOrProtected|MulticastAttributes.Public|MulticastAttributes.AnyVisibility|MulticastAttributes.Static|MulticastAttributes.Instance|MulticastAttributes.AnyScope|MulticastAttributes.NonAbstract|MulticastAttributes.Managed)] public abstract class OnMethodBoundaryAspect : ExceptionHandlerAspect, IOnMethodBoundaryAspect, IExceptionHandlerAspect, ILaosMethodLevelAspect, ILaosWeavableAspect, IInstanceBoundLaosAspect, ILaosAspect |
| Visual C++ |
|---|
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Constructor|AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Event, AllowMultiple = true, Inherited = false)] [MulticastAttributeUsageAttribute(MulticastTargets::Default|MulticastTargets::Method|MulticastTargets::Constructor, AllowMultiple = true, TargetMemberAttributes = MulticastAttributes::Default|MulticastAttributes::Private|MulticastAttributes::Protected|MulticastAttributes::Internal|MulticastAttributes::InternalAndProtected|MulticastAttributes::InternalOrProtected|MulticastAttributes::Public|MulticastAttributes::AnyVisibility|MulticastAttributes::Static|MulticastAttributes::Instance|MulticastAttributes::AnyScope|MulticastAttributes::NonAbstract|MulticastAttributes::Managed)] public ref class OnMethodBoundaryAspect abstract : public ExceptionHandlerAspect, IOnMethodBoundaryAspect, IExceptionHandlerAspect, ILaosMethodLevelAspect, ILaosWeavableAspect, IInstanceBoundLaosAspect, ILaosAspect |
Remarks
This custom attribute is useful to implement "boundary" functionalities like tracing (writing a
line to log) or transactions (automatically start a transaction at entry and commit or rollback
at exit).
Inheritance Hierarchy
System..::.Object
System..::.Attribute
PostSharp.Extensibility..::.MulticastAttribute
PostSharp.Laos..::.LaosAspect
PostSharp.Laos..::.LaosWeavableAspect
PostSharp.Laos..::.LaosMethodLevelAspect
PostSharp.Laos..::.ExceptionHandlerAspect
PostSharp.Laos..::.OnMethodBoundaryAspect
System..::.Attribute
PostSharp.Extensibility..::.MulticastAttribute
PostSharp.Laos..::.LaosAspect
PostSharp.Laos..::.LaosWeavableAspect
PostSharp.Laos..::.LaosMethodLevelAspect
PostSharp.Laos..::.ExceptionHandlerAspect
PostSharp.Laos..::.OnMethodBoundaryAspect