Adding an OnException attribute using PostSharp
问题 I am adventuring into some AOP and it seems with .NET PostSharp is the way to go. I want to do some simple logging to the db when an exception occurs. However I am finding it difficult to find any real solid examples of using PostSharp beyond the basics. I tried the following: [Serializable] public sealed class LogExceptionAttribute : ExceptionHandlerAspect { public override void OnException(MethodExecutionEventArgs eventArgs) { //do some logging here } } And then attaching a [LogException]