Exemplo n.º 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));
        }
Exemplo n.º 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);
        }