Beispiel #1
0
        private static ActionSelectionTable <Endpoint> CreateTableWithEndpoints(IReadOnlyList <ActionDescriptor> actions)
        {
            var endpoints = actions.Select(a =>
            {
                var metadata = new List <object>(a.EndpointMetadata ?? Array.Empty <object>());
                metadata.Add(a);
                return(new Endpoint(
                           requestDelegate: context => Task.CompletedTask,
                           metadata: new EndpointMetadataCollection(metadata),
                           displayName: a.DisplayName));
            });

            return(ActionSelectionTable <ActionDescriptor> .Create(endpoints));
        }
        private static ActionSelectionTable <RouteEndpoint> CreateTableWithEndpoints(IReadOnlyList <ActionDescriptor> actions)
        {
            var endpoints = actions.Select(a =>
            {
                var metadata = new List <object>(a.EndpointMetadata ?? Array.Empty <object>());
                metadata.Add(a);
                return(new RouteEndpoint(
                           requestDelegate: context => Task.CompletedTask,
                           routePattern: RoutePatternFactory.Parse("/", defaults: a.RouteValues, parameterPolicies: null, requiredValues: a.RouteValues),
                           order: 0,
                           metadata: new EndpointMetadataCollection(metadata),
                           a.DisplayName));
            });

            return(ActionSelectionTable <ActionDescriptor> .Create(endpoints));
        }
 private static ActionSelectionTable <ActionDescriptor> CreateTableWithActionDescriptors(IReadOnlyList <ActionDescriptor> actions)
 {
     return(ActionSelectionTable <ActionDescriptor> .Create(new ActionDescriptorCollection(actions, 0)));
 }