private void Proceed <T>(IInvocation invocation) { invocation.ReturnValue = _Queue.Enqueue(() => { return(invocation.Call <Task <T> >()); }); }
public void Intercept(IInvocation invocation) { var method = invocation.Method; var td = method.ReturnType.GetTaskType(); switch (td.MethodType) { case TaskType.None: throw new NotSupportedException("Actor method should only return Task or Task<T>"); case TaskType.Task: invocation.ReturnValue = _Queue.Enqueue(() => { return(invocation.Call <Task>()); }); break; case TaskType.GenericTask: var mi = _Proceed.MakeGenericMethod(td.Type); mi.Invoke(this, new[] { invocation }); break; } }