Пример #1
0
        public static async Task <OperationDetails> Wrap(Func <OperationDetails, Task <OperationDetails> > func, [CallerMemberName] string operationName = "")
        {
            OperationDetails res = null;

            try
            {
                res = await func.Invoke(new OperationDetails(operationName));
            }
            catch (Exception e)
            {
                if (res == null)
                {
                    res = new OperationDetails(operationName);
                }
                res.SetException(e);
            }
            return(res ?? new OperationDetails(operationName));
        }