Esempio n. 1
0
        public Task ExecuteAsync(CancellationToken cancellationToken)
        {
            ActionInvoker actionInvoker = new ActionInvoker(this.context, cancellationToken, this.services);

            // Empty filters is the default case so avoid delegates
            // Ensure empty case remains the same as the filtered case
            if (this.filters.Length == 0)
            {
                return actionInvoker.InvokeActionAsync();
            }

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization
            Func<ActionInvoker, Task> invokeCallback = innerInvoker => innerInvoker.InvokeActionAsync();
            return InvokeActionWithActionFilters(this.context, cancellationToken, this.filters, invokeCallback, actionInvoker)();
        }
Esempio n. 2
0
        public Task ExecuteAsync(CancellationToken cancellationToken)
        {
            ActionInvoker actionInvoker = new ActionInvoker(this.context, cancellationToken, this.services);

            // Empty filters is the default case so avoid delegates
            // Ensure empty case remains the same as the filtered case
            if (this.filters.Length == 0)
            {
                return(actionInvoker.InvokeActionAsync());
            }

            // Ensure delegate continues to use the C# Compiler static delegate caching optimization
            Func <ActionInvoker, Task> invokeCallback = innerInvoker => innerInvoker.InvokeActionAsync();

            return(InvokeActionWithActionFilters(this.context, cancellationToken, this.filters, invokeCallback, actionInvoker)());
        }
        public async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            await _binding.ExecuteBindingAsync(_context, cancellationToken);

            ActionInvoker actionInvoker = new ActionInvoker(_context, cancellationToken, _services);

            // Empty filters is the default case so avoid delegates
            // Ensure empty case remains the same as the filtered case
            if (_filters.Length == 0)
            {
                return(await actionInvoker.InvokeActionAsync());
            }
            // Ensure delegate continues to use the C# Compiler static delegate caching optimization
            Func <ActionInvoker, Task <HttpResponseMessage> > invokeCallback = (innerInvoker) =>
                                                                               innerInvoker.InvokeActionAsync();

            return(await InvokeActionWithActionFilters(_context, cancellationToken, _filters, invokeCallback,
                                                       actionInvoker)());
        }