Using TransactionScope with async/await

In .NET Framework 4.5, Microsoft introduced async and await keywords in C# to simplify non-blocking programming. Microsoft has a very nice article about asynchronous programming on MSDN. However, transactions were not aware of async/await in .NET 4.5 (perhaps that would also be the reason EntityFramework did not come out with async support that time.)

In .NET Framework 4.5.1, Microsoft addressed the async issue. TransactionScope is now aware of async/await and it has now an option to enable an ambient transaction to “flow across thread continuations.” The usage is very simple: