예제 #1
0
        public Task EndTransactionAsync(Guid operationId, Guid transactionId)
        {
            var partitionKey = ActiveTransactionEntity.GetPartitionKey(operationId);
            var rowKey       = ActiveTransactionEntity.GetRowKey(operationId);

            return(_storage.DeleteIfExistAsync(
                       partitionKey,
                       rowKey,
                       entity => entity.TransactionId == transactionId));
        }
예제 #2
0
        public async Task <Guid> GetOrStartTransactionAsync(Guid operationId, Func <Guid> newTransactionIdFactory)
        {
            var partitionKey = ActiveTransactionEntity.GetPartitionKey(operationId);
            var rowKey       = ActiveTransactionEntity.GetRowKey(operationId);

            var entity = await _storage.GetOrInsertAsync(
                partitionKey,
                rowKey,
                () => new ActiveTransactionEntity
            {
                PartitionKey  = partitionKey,
                RowKey        = rowKey,
                TransactionId = newTransactionIdFactory()
            });

            return(entity.TransactionId);
        }