Global.asax.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Swashbuckle.Extension.Mvc;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Http;
  7. using System.Web.Http.Description;
  8. using System.Web.Mvc;
  9. using System.Web.Optimization;
  10. using System.Web.Routing;
  11. using TF.Config;
  12. namespace TfRiskControlApi
  13. {
  14. public class MvcApplication : System.Web.HttpApplication
  15. {
  16. protected void Application_Start()
  17. {
  18. //¼ÓÔØÅäÖÃÎļþ
  19. if (!ConfigManager.LoadConfig())
  20. {
  21. throw new Exception("Load config failed.");
  22. }
  23. var assembly = typeof(TfRiskControlApi.MvcApplication).Assembly;
  24. var apiExplorer = new MvcApiExplorer(assembly, GlobalConfiguration.Configuration);
  25. GlobalConfiguration.Configuration.Services.Replace(typeof(IApiExplorer), apiExplorer);
  26. AreaRegistration.RegisterAllAreas();
  27. FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  28. RouteConfig.RegisterRoutes(RouteTable.Routes);
  29. BundleConfig.RegisterBundles(BundleTable.Bundles);
  30. }
  31. }
  32. }