public Task <string> RunAction <T>(T tracker, string method, string arguments) where T : IActionTracker { IImmutableDictionary <string, ActionMethod> methods = ActionMethods.Get <T>(); if (!methods.TryGetValue(method, out ActionMethod actionMethod)) { throw new ArgumentException("Specified method not found.", nameof(method)); } object[] args = actionMethod.DeserializeArguments(arguments); return((Task <string>)InvokeActionNoResultMethod.MakeGenericMethod(actionMethod.ResultType) .Invoke(this, new object[] { tracker, actionMethod, args })); }
public async Task <T> ExecuteAction <T>(Expression <Func <Task <ActionResult <T> > > > actionExpression) { if (!(actionExpression.Body is MethodCallExpression mce)) { throw new ArgumentException("Expression must be a call expression.", nameof(actionExpression)); } MethodInfo methodInfo = mce.Method; var target = (IActionTracker)GetValue(mce.Object); ActionMethod method = ActionMethods.Get(target.GetType())[methodInfo.Name]; object[] arguments = GetArguments(mce.Arguments).ToArray(); ActionResult <T> result = await InvokeAction <T>(target, method, arguments); if (result == null) { return(default);