Entity Framework Core and DocumentDB Transaction

azure-cosmosdb entity-framework-core transactions

Question

is there any way to execute an all-or-nothing transaction with both systems included? E.g.

using(transaction) {
    DbContext.SaveChanges();
    DocumentClient.DoStuff();
    transaction.Commit();
}

EF Core does not seem to support Transaction Scope.

1
0
9/8/2017 8:45:05 AM

Popular Answer

Cosmos DB and your other database (SQL DB) are completely separate. There's no way to wrap operations from both into a single transaction.

Cosmos DB will let you operate within its own transaction mechanism, via stored procedures: operations within a Cosmos DB stored procedure are "all or nothing." But... This is independent of a TransactionScope.

1
9/8/2017 10:14:18 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow