public async Task <int> InvokeAsync(InvocationContext context) { var bindingContext = context.BindingContext; var(boundValues, _) = ModelBinder.GetBoundValues( invokeArgumentBindingSources, bindingContext, _methodDescriptor.ParameterDescriptors, _enforceExplicitBinding); var invocationArguments = boundValues .Select(x => x.Value) .ToArray(); object result; if (_handlerDelegate is null) { var invocationTarget = _invocationTarget ?? _invocationTargetBinder?.CreateInstance(bindingContext); result = _handlerMethodInfo !.Invoke(invocationTarget, invocationArguments); } else { result = _handlerDelegate.DynamicInvoke(invocationArguments); } return(await CommandHandler.GetResultCodeAsync(result, context)); }
public async Task <int> InvokeAsync(InvocationContext context) { var bindingContext = context.BindingContext; var parameterBinders = _parameterDescriptors .Select(p => bindingContext.GetModelBinder(p)) .ToList(); var invocationArguments = parameterBinders .Select(binder => binder.CreateInstance(bindingContext)) .ToArray(); var invocationTarget = _invocationTarget ?? _invocationTargetBinder?.CreateInstance(bindingContext); object result; if (_handlerDelegate == null) { result = _handlerMethodInfo.Invoke( invocationTarget, invocationArguments); } else { result = _handlerDelegate.DynamicInvoke(invocationArguments); } return(await CommandHandler.GetResultCodeAsync(result, context)); }
public async Task <int> InvokeAsync(InvocationContext context) { var bindingContext = context.BindingContext; var invocationTarget = _invocationTargetBinder?.CreateInstance(bindingContext); var invocationArguments = _parameterBinders.Select(p => p.CreateInstance(bindingContext)) .ToArray(); var result = _handlerDelegate == null ? _handlerMethodInfo.Invoke( invocationTarget, invocationArguments) : _handlerDelegate.DynamicInvoke(invocationArguments); return(await CommandHandler.GetResultCodeAsync(result, context)); }
public Task <int> InvokeAsync(InvocationContext context) { var value = InvokeMethod(context); return(CommandHandler.GetResultCodeAsync(value, context)); }