Ejemplo n.º 1
0
        /// <summary>
        /// Executes the target activity method.
        /// </summary>
        /// <param name="argBytes">The encoded activity arguments.</param>
        /// <returns>The encoded activity results.</returns>
        private async Task <byte[]> RunAsync(byte[] argBytes)
        {
            var    args   = dataConverter.FromDataArray(argBytes);
            object result = null;

            if (activityMethod.ReturnType == typeof(Task))
            {
                // The activity method returns [Task] (effectively void).

                await(Task) activityMethod.Invoke(this, args);
            }
            else
            {
                // The activity method returns [Task<T>] (an actual result).

                result = await(Task <object>) activityMethod.Invoke(this, args);
            }

            return(dataConverter.ToData(result));
        }