Example #1
0
        /// <summary>
        /// Calls logging, validation and workflow interceptor implementations
        /// after service method returns
        /// </summary>
        /// <param name="invocation"><see cref="IInvocation"/> instance</param>
        protected override void PostMethodInvoke(IInvocation invocation)
        {
            try
            {
                // Call logging interceptor
                loggingInterceptor.PostMethodInvoke(invocation);

                // Call validation interceptor
                validationInterceptor.PostMethodInvoke(invocation);

                // Call workflow interceptor
                workflowInterceptor.PostMethodInvoke(invocation);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                // Log any errors
                if (logger.IsEnabled(LogLevel.Error))
                {
                    logger.LogError(e, $"Error executing {nameof(PostMethodInvoke)}");
                }
            }
        }