/// <summary>
        /// Occurs when a single action is matched to the route policy.
        /// </summary>
        /// <param name="context">The current <see cref="RouteContext">route context</see>.</param>
        /// <param name="selectionResult">The current <see cref="ActionSelectionResult">action selection result</see>.</param>
        /// <param name="match">The <see cref="ActionDescriptorMatch">matched</see> action.</param>
        protected virtual void OnSingleMatch(RouteContext context, ActionSelectionResult selectionResult, ActionDescriptorMatch match)
        {
            Arg.NotNull(context, nameof(context));
            Arg.NotNull(selectionResult, nameof(selectionResult));
            Arg.NotNull(match, nameof(match));

            var handler = new DefaultActionHandler(ActionInvokerFactory, ActionContextAccessor, selectionResult, match);

            match.Action.AggregateAllVersions(selectionResult.CandidateActions);
            context.Handler = handler.Invoke;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Occurs when a single action is matched to the route policy.
        /// </summary>
        /// <param name="context">The current <see cref="RouteContext">route context</see>.</param>
        /// <param name="selectionResult">The current <see cref="ActionSelectionResult">action selection result</see>.</param>
        /// <param name="match">The <see cref="ActionDescriptorMatch">matched</see> action.</param>
        protected virtual void OnSingleMatch(RouteContext context, ActionSelectionResult selectionResult, ActionDescriptorMatch match)
        {
            Arg.NotNull(context, nameof(context));
            Arg.NotNull(selectionResult, nameof(selectionResult));
            Arg.NotNull(match, nameof(match));

            var handler = new DefaultActionHandler(ActionInvokerFactory, ActionContextAccessor, selectionResult, match);

            context.RouteData = match.RouteData;
            context.Handler   = handler.Invoke;
        }
Exemplo n.º 3
0
    public Action GetNextAction()
    {
        var h0 = new CompleteTreeActionHandler();
        var h1 = new GrowTreeActionHandler();
        var h2 = new EjectSeedActionHandler();
        var h3 = new DefaultActionHandler();

        h0.SetSuccessor(h1);
        h1.SetSuccessor(h2);
        h2.SetSuccessor(h3);

        var finalAction = h0.HandleActions(this);

        return(finalAction);
    }