Exemple #1
0
        /// <summary>
        /// Registers an handler for a specific exception.
        /// </summary>
        /// <typeparam name="TExceptionHandler">The type of the exception handler.</typeparam>
        /// <param name="exceptionService">The exception service.</param>
        /// <returns>The handler to use.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="exceptionService"/> is <c>null</c>.</exception>
        public static IExceptionHandler Register <TExceptionHandler>(this IExceptionService exceptionService)
            where TExceptionHandler : IExceptionHandler, new()
        {
            Argument.IsNotNull("exceptionService", exceptionService);

            var exceptionHandler = new TExceptionHandler();

            return(exceptionService.Register(exceptionHandler));
        }