public FuncExecutionResult <T> TryExecute <T>(Func <T> code) { FuncExecutionResult <T> result; try { var codeResult = code.Invoke(); result = FuncExecutionResult <T> .SuccessResult(executedBy : this, executedCode : code, value : codeResult); } catch (Exception ex) { this.HandleException(ex); result = FuncExecutionResult <T> .FailedResult(executedBy : this, executedCode : code, exception : ex); } this.OnResult(result); return(result); }
protected virtual void OnResult <T>(FuncExecutionResult <T> result) { }