Following Microsoft documentation with TransactionScope
https://learn.microsoft.com/en-us/ef/ef6/saving/transactions#passing-an-existing-transaction-to-the-context
There are still some limitations to the TransactionScope approach:
Requires .NET 4.5.1 or greater to work with asynchronous methods.
It cannot be used in cloud scenarios unless you are sure you have one
and only one connection (cloud scenarios do not support distributed
transactions).It cannot be combined with the Database.UseTransaction() approach of
the previous sections.It will throw exceptions if you issue any DDL and have not enabled
distributed transactions through the MSDTC Service.
I understand “The cloud scenario” as “the runtime environment is not a fully-featured VM”
So
- Cloud or local databases do not matters, we can use TransactionScope
- If we use full-featured Windows or Linux VMs runtime, we can use TransactionScope
- If we use docker images in Kubernetes it may not work?
- If we use any cloud-hosting services (Azure AppServices, Elastic BeanStalk…) it will not work ?
Do we have a concrete definition for “cloud scenario”?