Apistry.Samples.Presentation.Web.Controllers.DocumentationController.Index C# (CSharp) Method

Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            var docProvider = (WebApiDocumentationProvider)GlobalConfiguration.Configuration.Services.GetDocumentationProvider();
            var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer();

            var apiActionDescriptions = apiExplorer.ApiDescriptions
                .AsParallel()
                .WithDegreeOfParallelism(1) // for debugging
                //.WithDegreeOfParallelism(Environment.ProcessorCount) // production
                .Select(description => CreateApiActionDescription(description, docProvider))
                .ToList();

            // You should probably cache the above documentation and generate it only when needed.

            return View(apiActionDescriptions);
        }