Пример #1
0
        /// <summary>
        /// Configures the <see cref="IStashboxContainer"/> as the default dependency resolver and sets custom <see cref="IFilterProvider"/> and <see cref="ModelValidatorProvider"/>.
        /// </summary>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="container"/> or <paramref name="config"/> is <c>null</c>.
        /// </exception>
        public static IStashboxContainer AddWebApi(this IStashboxContainer container, HttpConfiguration config)
        {
            Shield.EnsureNotNull(container, nameof(container));
            Shield.EnsureNotNull(config, nameof(config));

            container.AddWebApiModelValidatorInjection(config);
            container.AddWebApiFilterProviderInjection(config);

            config.DependencyResolver = new StashboxDependencyResolver(container);
            container.RegisterWebApiControllers(config);

            return(container);
        }