public List <ActionDescriptor> GetActions(ActionSourceContext context)
        {
            var configuration = new Configuration();

            new ConfigurationDsl(configuration)
            .IncludeTypeAssembly <DiagnosticsActionSource>()
            .OnlyIncludeHandlersUnder <DiagnosticsActionSource>()
            .ExcludeTypeNamespaceFromUrl <DiagnosticsActionSource>();

            var actionMethodSource = new DefaultActionMethodSource(configuration, _typeCache);
            var urlConvention      = new LambdaUrlConvention((a, s) => _configuration
                                                             .DiagnosticsUrl.Trim('/').AsList(s).Join("/").AsArray());
            var urlConventions = new List <IUrlConvention> {
                urlConvention
            };
            var routeConvention = new DefaultRouteConvention(configuration, urlConventions);

            return(new DefaultActionSource(actionMethodSource.AsList(),
                                           routeConvention.AsList(), configuration, _typeCache)
                   .GetActions(new ActionSourceContext(configuration, context.HttpConfiguration)));
        }
Exemple #2
0
        public List <ActionDescriptor> GetActions()
        {
            var configuration      = new Configuration();
            var actionMethodSource = new DefaultActionMethodSource(configuration, _typeCache);
            var urlConvention      = new DefaultUrlConvention(configuration, _httpConfiguration);
            var routeConvention    = new DefaultRouteConvention(configuration,
                                                                _httpConfiguration, urlConvention.AsList <IUrlConvention>(), _constraintBuilder);

            new ConfigurationDsl(configuration, _httpConfiguration)
            .IncludeTypeAssembly <DiagnosticsActionSource>()
            .OnlyIncludeHandlersUnder <DiagnosticsActionSource>()
            .ConfigureNamespaceUrlMapping(x => x.Clear()
                                          .MapNamespaceAfter <DiagnosticsActionSource>())
            .WithUrlPrefix(_configuration.DiagnosticsUrl.Trim('/'))
            .ConfigureUrlConventions(x => x.Clear().Append(urlConvention))
            .ConfigureActionMethodSources(x => x.Clear().Append(actionMethodSource))
            .ConfigureRouteConventions(x => x.Clear().Append(routeConvention));

            return(new DefaultActionSource(configuration, _httpConfiguration,
                                           actionMethodSource.AsList(), routeConvention.AsList(),
                                           _actionDescriptorFactory).GetActions());
        }