public static Task<object> ExecuteAsync(
     ObjectMethodExecutor actionMethodExecutor,
     object instance,
     object[] orderedActionArguments)
 {
     return actionMethodExecutor.ExecuteAsync(instance, orderedActionArguments);
 }
Example #2
0
        private static async Task <object> ExecuteHubMethod(ObjectMethodExecutor methodExecutor, THub hub, object[] arguments)
        {
            // ReadableChannel is awaitable but we don't want to await it.
            if (methodExecutor.IsMethodAsync && !IsChannel(methodExecutor.MethodReturnType, out _))
            {
                if (methodExecutor.MethodReturnType == typeof(Task))
                {
                    await(Task) methodExecutor.Execute(hub, arguments);
                }
                else
                {
                    return(await methodExecutor.ExecuteAsync(hub, arguments));
                }
            }
            else
            {
                return(methodExecutor.Execute(hub, arguments));
            }

            return(null);
        }
Example #3
0
 public Task RouteAsync(RouteContext route)
 {
     if (route.Handler == null)
     {
         route.Handler = async(context) =>
         {
             object   instance   = context.RequestServices.GetRequiredService(this.Service);
             object[] methodArgs = context.Request.Parameters;
             object   resultObj;
             if (_methodExecutor.IsMethodAsync)
             {
                 resultObj = await _methodExecutor.ExecuteAsync(instance, methodArgs);
             }
             else
             {
                 resultObj = _methodExecutor.Execute(instance, methodArgs);
             }
             context.Response.Success(resultObj);
         };
     }
     return(Task.CompletedTask);
 }
 public async Task AsyncExecutor_CompiledNormally_ExecuteAsync_WithAwait()
 {
     await _execCompiled.ExecuteAsync(this, _parameters);
 }
Example #5
0
 public async Task Compiled() => await _compiled.ExecuteAsync(this, _parameters);