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

                // call validation interceptor
                validationInterceptor.PreMethodInvoke(invocation);

                // call workflow interceptor
                workflowInterceptor.PreMethodInvoke(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(PreMethodInvoke)}");
                }
            }
        }