R DoLoggedOperation<R>(string startMessage, Func<OperationLogging, R> operation) { var logging = new OperationLogging(Configuration); try { logging.Start(startMessage); return operation(logging); } finally { logging.End(); } }
public TypedValue Operate <O>(params object[] parameters) where O : class { var operationType = typeof(O).Name; var operationName = operationType.Substring(0, operationType.IndexOf("Operator")); var logging = new OperationLogging(Configuration); try { logging.Start(operationName); logging.LogParameters(parameters); var candidate = Operators.FindOperator <O>(parameters); var member = RuntimeType.FindDirectInstance(candidate, new IdentifierName(operationName), parameters.Length); var result = member.Invoke(parameters).GetValue <TypedValue>(); logging.LogResult(candidate, result); return(result); } finally { logging.End(); } }
public TypedValue Operate <O>(params object[] parameters) where O : class { var operationType = typeof(O).Name; var operationName = operationType.Substring(0, operationType.IndexOf("Operator")); var logging = new OperationLogging(Memory); try { logging.Start(operationName); logging.LogParameters(parameters); var candidate = Operators.FindOperator <O>(parameters); var member = MemberQuery.GetDirectInstance(candidate, new MemberSpecification(operationName, parameters.Length)); var result = member.Invoke(parameters).GetValue <TypedValue>(); logging.LogResult(candidate, result); return(result); } finally { logging.End(); } }