protected InvokeResult InvokeListenerMethodOnListenerObject(object requestObject) { InvokeResult returnValue = new InvokeResult(); try { var safeMethod = new Oragon.Spring.Reflection.Dynamic.SafeMethod(this._listenerMethod); var invocationResult = safeMethod.Invoke(this._listenerObject, requestObject); if (this._listenerMethod.ReturnType.IsAssignableFrom(typeof(Task))) { ((Task)invocationResult).GetAwaiter().GetResult(); if (this._listenerMethod.ReturnType.IsGenericType) { returnValue.ReturnedValue = ((Task <dynamic>)invocationResult).Result; } else { returnValue.ReturnedValue = null; } } else { returnValue.ReturnedValue = invocationResult; } } catch (System.Exception ex) { returnValue.Exception = ex; } return(returnValue); }
private void InitializeServices() { foreach (QueuedTransition queuedTransition in this.GetAvailableTransitions()) { MethodInfo method = Oragon.Spring.Util.ReflectionUtils.GetMethod(queuedTransition.Service.GetType(), "QueuedStateMachineInitialize", new Type[] { }); if (method != null) { var safeMethod = new Oragon.Spring.Reflection.Dynamic.SafeMethod(method); safeMethod.Invoke(queuedTransition.Service, null); } } }