Beispiel #1
0
    private PageHandlerBinderDelegate[] GetHandlerBinders(CompiledPageActionDescriptor actionDescriptor)
    {
        if (actionDescriptor.HandlerMethods == null || actionDescriptor.HandlerMethods.Count == 0)
        {
            return(Array.Empty <PageHandlerBinderDelegate>());
        }

        var results = new PageHandlerBinderDelegate[actionDescriptor.HandlerMethods.Count];

        for (var i = 0; i < actionDescriptor.HandlerMethods.Count; i++)
        {
            results[i] = PageBinderFactory.CreateHandlerBinder(
                _parameterBinder,
                _modelMetadataProvider,
                _modelBinderFactory,
                actionDescriptor,
                actionDescriptor.HandlerMethods[i]);
        }

        return(results);
    }
Beispiel #2
0
        private async Task BindArgumentsCoreAsync()
        {
            await CacheEntry.PropertyBinder(_pageContext, _instance);

            if (_handler == null)
            {
                return;
            }

            // We do two separate cache lookups, once for the binder and once for the executor.
            // Reducing it to a single lookup requires a lot of code change with little value.
            PageHandlerBinderDelegate handlerBinder = null;
            for (var i = 0; i < _actionDescriptor.HandlerMethods.Count; i++)
            {
                if (object.ReferenceEquals(_handler, _actionDescriptor.HandlerMethods[i]))
                {
                    handlerBinder = CacheEntry.HandlerBinders[i];
                    break;
                }
            }

            await handlerBinder(_pageContext, _arguments);
        }