protected static async Task <TResult> ExecuteOperation <TResult>(IRollbackableOperation <TResult> operation)
 {
     if (IsInTransaction())
     {
         await EnlistOperation(operation);
     }
     else
     {
         await operation.Execute();
     }
     return(operation.Result);
 }
Esempio n. 2
0
        /// <summary>
        /// Enlists <paramref name="operation"/> in its journal, so it will be committed or rolled
        /// together with the other enlisted operations.
        /// </summary>
        /// <param name="operation"></param>
        public async Task EnlistOperation(IRollbackableOperation operation)
        {
            await operation.Execute();

            _journal.Add(operation);
        }
Esempio n. 3
0
        /// <summary>
        /// Enlists <paramref name="operation"/> in its journal, so it will be committed or rolled back
        /// together with the other enlisted operations.
        /// </summary>
        /// <param name="operation"></param>
        public void EnlistOperation(IRollbackableOperation operation)
        {
            operation.Execute();

            _journal.Add(operation);
        }
        /// <summary>
        /// Enlists <paramref name="operation"/> in its journal, so it will be committed or rolled
        /// together with the other enlisted operations.
        /// </summary>
        /// <param name="operation"></param>
        public void EnlistOperation(IRollbackableOperation operation)
        {
            operation.Execute();

            journal.Add(operation);
        }