// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. using System.Web.Http.Dispatcher; using System.Web.Http.WebHost; using System.Web.Http.WebHost.Routing; using System.Web.Routing; namespace System.Web.Http { /// /// Provides a global for ASP applications. /// public static class GlobalConfiguration { private static Lazy _configuration = new Lazy( () => { HttpConfiguration config = new HttpConfiguration(new HostedHttpRouteCollection(RouteTable.Routes)); config.Services.Replace(typeof(IAssembliesResolver), new WebHostAssembliesResolver()); config.Services.Replace(typeof(IHttpControllerTypeResolver), new WebHostHttpControllerTypeResolver()); return config; }); private static Lazy _dispatcher = new Lazy( () => { return new HttpControllerDispatcher(_configuration.Value); }); /// /// Gets the global . /// public static HttpConfiguration Configuration { get { return _configuration.Value; } } /// /// Gets the global . /// public static HttpControllerDispatcher Dispatcher { get { return _dispatcher.Value; } } } }