internal IEnumerable <ControllerActionDescriptor> GetDescriptors()
        {
            var applicationModel = BuildModel();

            ApplicationModelConventions.ApplyConventions(applicationModel, _conventions);
            return(ControllerActionDescriptorBuilder.Build(applicationModel));
        }
        public ApplicationModel CreateApplicationModel(IEnumerable <TypeInfo> controllerTypes)
        {
            if (controllerTypes == null)
            {
                throw new ArgumentNullException(nameof(controllerTypes));
            }

            var context = new ApplicationModelProviderContext(controllerTypes);

            for (var i = 0; i < _applicationModelProviders.Length; i++)
            {
                _applicationModelProviders[i].OnProvidersExecuting(context);
            }

            for (var i = _applicationModelProviders.Length - 1; i >= 0; i--)
            {
                _applicationModelProviders[i].OnProvidersExecuted(context);
            }

            ApplicationModelConventions.ApplyConventions(context.Result, _conventions);

            return(context.Result);
        }