예제 #1
0
        private async Task <ActionDescriptor> InvokeActionSelector(RouteContext context)
        {
            var actionDescriptorProvider = GetActionDescriptorProvider();

            // service container does not work quite like our built in Depenency Injection container.
            var serviceContainer = new ServiceContainer();
            var list             = new List <IActionDescriptorProvider>()
            {
                actionDescriptorProvider,
            };

            serviceContainer.AddService(typeof(IEnumerable <IActionDescriptorProvider>), list);

            var actionCollectionDescriptorProvider = new DefaultActionDescriptorsCollectionProvider(serviceContainer);
            var decisionTreeProvider = new ActionSelectorDecisionTreeProvider(actionCollectionDescriptorProvider);

            var actionConstraintProviders = new IActionConstraintProvider[] {
                new DefaultActionConstraintProvider(),
            };

            var defaultActionSelector = new DefaultActionSelector(
                actionCollectionDescriptorProvider,
                decisionTreeProvider,
                actionConstraintProviders,
                NullLoggerFactory.Instance);

            return(await defaultActionSelector.SelectAsync(context));
        }
예제 #2
0
        private ActionDescriptor InvokeActionSelector(RouteContext context)
        {
            var actionDescriptorProvider = GetActionDescriptorProvider();

            var serviceContainer = new ServiceCollection();
            var list             = new List <IActionDescriptorProvider>()
            {
                actionDescriptorProvider,
            };

            serviceContainer.AddSingleton(typeof(IEnumerable <IActionDescriptorProvider>), list);

            var actionDescriptorCollectionProvider = new DefaultActionDescriptorCollectionProvider(
                serviceContainer.BuildServiceProvider());
            var decisionTreeProvider = new ActionSelectorDecisionTreeProvider(actionDescriptorCollectionProvider);

            var actionConstraintProviders = new[]
            {
                new DefaultActionConstraintProvider(),
            };

            var defaultActionSelector = new DefaultActionSelector(
                decisionTreeProvider,
                actionConstraintProviders,
                NullLoggerFactory.Instance);

            return(defaultActionSelector.Select(context));
        }
        private async Task<ActionDescriptor> InvokeActionSelector(RouteContext context)
        {
            var actionDescriptorProvider = GetActionDescriptorProvider();

            // service container does not work quite like our built in Depenency Injection container.
            var serviceContainer = new ServiceContainer();
            var list = new List<IActionDescriptorProvider>()
            {
                actionDescriptorProvider,
            };

            serviceContainer.AddService(typeof(IEnumerable<IActionDescriptorProvider>), list);

            var actionCollectionDescriptorProvider = new DefaultActionDescriptorsCollectionProvider(serviceContainer);
            var decisionTreeProvider = new ActionSelectorDecisionTreeProvider(actionCollectionDescriptorProvider);

            var actionConstraintProviders = new IActionConstraintProvider[] {
                    new DefaultActionConstraintProvider(),
                };

            var defaultActionSelector = new DefaultActionSelector(
                actionCollectionDescriptorProvider,
                decisionTreeProvider,
                actionConstraintProviders,
                NullLoggerFactory.Instance);

            return await defaultActionSelector.SelectAsync(context);
        }
        private ActionDescriptor InvokeActionSelector(RouteContext context)
        {
            var actionDescriptorProvider = GetActionDescriptorProvider();

            var serviceContainer = new ServiceCollection();
            var list = new List<IActionDescriptorProvider>()
            {
                actionDescriptorProvider,
            };

            serviceContainer.AddSingleton(typeof(IEnumerable<IActionDescriptorProvider>), list);

            var actionDescriptorCollectionProvider = new DefaultActionDescriptorCollectionProvider(
                serviceContainer.BuildServiceProvider());
            var decisionTreeProvider = new ActionSelectorDecisionTreeProvider(actionDescriptorCollectionProvider);

            var actionConstraintProviders = new[]
            {
                new DefaultActionConstraintProvider(),
            };

            var defaultActionSelector = new DefaultActionSelector(
                decisionTreeProvider,
                actionConstraintProviders,
                NullLoggerFactory.Instance);

            return defaultActionSelector.Select(context);
        }