user2981411
user2981411

Reputation: 962

Enlisting a Cosmos transaction in a Sql Server Database Transaction

We are using Entity Framework Core 3 and Cosmos 3.4 with Sql API.

Is it possible to enlist a Cosmos (Microsoft DocumentDb) transaction in a Sql Server Transaction so that the RollBack/Commit applies to Both Sql Server and the Cosmos.

Many thanks

Upvotes: 1

Views: 370

Answers (1)

David Makogon
David Makogon

Reputation: 71118

Cosmos DB has no transactional support outside of Cosmos DB itself. Its transactions are either at the document level (e.g. inserting a document) or at a stored procedure level (e.g. modifying several documents within the stored procedure, which takes place within a single partition of a single collection).

There's no way to have actual transactional commit/rollback connected with SQL Server (or any other database) outside of Cosmos DB. You'd need come up with your own strategy for keeping data in sync between the two databases.

Upvotes: 1

Related Questions