mbue
mbue

Reputation: 1632

Entity Framework Core and DocumentDB Transaction

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.

Upvotes: 0

Views: 676

Answers (1)

David Makogon
David Makogon

Reputation: 71118

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.

Upvotes: 1

Related Questions