Open sandboxFocus

Class AuditAttribute

Custom attribute that, when applied to a method, causes PostSharp to audit the execution of this method. Whenever an audited method is executed, the RecordPublished event is raised. You need to register your own logic with the RecordPublished event, for example to append the record to a database table.

Namespace: PostSharp.Patterns.Diagnostics.Audit
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
[Obsolete("This feature has been moved to the sample PostSharp.Samples.Logging.Audit.")]
public class AuditAttribute : LogAttributeBase, IMethodLevelAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ILogAspect, IAspect
Remarks

Audit is a special kind of logging. The AuditAttribute aspect adds logging with the Audit profile, which is by default served by the AuditBackend backend, which exposes a simple API to the AuditServices class.

The AuditAttribute aspect can be used side-by-side with the LogAttribute aspect.

Constructors

Name Description
AuditAttribute()

Initializes a new instance of the AuditAttribute class.