Esempio n. 1
0
        internal static IExceptionLogger CreateLogger(ServicesContainer services)
        {
            Contract.Requires(services != null);

            IEnumerable<IExceptionLogger> loggers = services.GetExceptionLoggers();
            Contract.Assume(loggers != null);
            return new CompositeExceptionLogger(loggers);
        }
Esempio n. 2
0
            public ActionInvoker(EventHandlerContext context, CancellationToken cancellationToken, ServicesContainer services)
            {
                Contract.Requires(services != null);

                this.context = context;
                this.cancellationToken = cancellationToken;
                this.services = services;
            }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandlerServices"/> class.
        /// </summary>
        /// <param name="parent">
        /// The parent container.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="parent"/> is null.
        /// </exception>
        public HandlerServices(ServicesContainer parent)
        {
            if (parent == null)
            {
                throw Error.ArgumentNull("parent");
            }

            this.parent = parent;
        }
Esempio n. 4
0
        public EventHandlerFilterResult(EventHandlerContext context, ServicesContainer services, IEventHandlerFilter[] filters)
        {
            Contract.Requires(context != null);
            Contract.Requires(services != null);
            Contract.Requires(filters != null);

            this.context = context;
            this.services = services;
            this.filters = filters;
        }
Esempio n. 5
0
        /// <summary>
        /// Gets an exception handler that calls the registered handler service, if any, and ensures exceptions do not
        /// accidentally propagate to the host.
        /// </summary>
        /// <param name="services">The services container.</param>
        /// <returns>
        /// An exception handler that calls any registered handler and ensures exceptions do not accidentally propagate
        /// to the host.
        /// </returns>
        public static IExceptionHandler GetHandler(ServicesContainer services)
        {
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }

            Lazy<IExceptionHandler> exceptionServicesHandler = services.ExceptionServicesHandler;
            Contract.Assume(exceptionServicesHandler != null);
            return exceptionServicesHandler.Value;
        }
Esempio n. 6
0
        /// <summary>Gets an exception logger that calls all registered logger services.</summary>
        /// <param name="services">The services container.</param>
        /// <returns>A composite logger.</returns>
        public static IExceptionLogger GetLogger(ServicesContainer services)
        {
            if (services == null)
            {
                throw Error.ArgumentNull("services");
            }

            Lazy<IExceptionLogger> exceptionServicesLogger = services.ExceptionServicesLogger;
            Contract.Assert(exceptionServicesLogger != null);
            return exceptionServicesLogger.Value;
        }
Esempio n. 7
0
        internal static IExceptionHandler CreateHandler(ServicesContainer services)
        {
            Contract.Requires(services != null);

            IExceptionHandler innerHandler = services.GetExceptionHandler() ?? new EmptyExceptionHandler();
            return new LastChanceExceptionHandler(innerHandler);
        }