Do Azure storage-related APIs participate in System.Transactions?
Asked Answered
C

2

7

I can't find any information on this anywhere and yet the question is simple.

Can I wrap storage-related actions in a TransactionScope such that e.g. if there is a rollback, the uploaded file is rolled back also?

If the native APIs don't do this already, is there a public implementation anywhere?

Cafeteria answered 4/8, 2013 at 17:20 Comment(0)
F
8

If you're referring to Table or Blob updates, there's no notion of explicit commit or rollback. When you make an API call (whether direct REST call or via PowerShell / CLI / SDK), it's just an action against storage, and it will either succeed or fail (although some actions take a while and the call may return before completion). There's no transaction scope wrapping this action. You'd need to take care of undoing your Table / Blob updates at an app level.

Footwall answered 4/8, 2013 at 18:26 Comment(2)
Can it really be called a database if you can't use it in a transactional manner?Willpower
Not sure what you're getting at. Table Storage has API transactions and even allows for multiple entities to be written within a single API call (transaction). Blob storage is separate from Table, and there's no containing transaction-scope object in which you can perform operations across the two,nor is there a way to perform multiple Table storage transactions within a transaction scope. However: That in no way diminishes Table storage from being a database. Take a look at MongoDB: Atomic operations within a document, no transactions across docs, yet... it's still considered a database.Footwall
F
0

As already answered, there is no built-in support for transactions as you have in SQL connections for example.

As you are using .NET, you can take advantage of .NET Transactions and build one yourself. Here you can see this more information in this related question:

Generic ResourceManager/IEnlistmentNotification for Azure Blob Storage operations to achieve 2 phase commit

Flemings answered 20/5, 2023 at 11:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.