在SQL Server数据库事务中登记Cosmos事务 [英] Enlisting a Cosmos transaction in a Sql Server Database Transaction

查看:88
本文介绍了在SQL Server数据库事务中登记Cosmos事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将Entity Framework Core 3和Cosmos 3.4与Sql API一起使用.

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

是否可以在Sql Server事务中注册一个Cosmos(Microsoft DocumentDb)事务,以便RollBack/Commit同时适用于Sql Server和Cosmos.

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.

非常感谢

推荐答案

Cosmos DB在Cosmos DB本身之外没有事务支持.它的事务是在文档级别(例如,插入文档)或在存储过程级别(例如,修改存储过程中的多个文档,这些操作在单个文档中进行)单个集合的分区).

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).

无法将实际的事务提交/回滚与Cosmos DB外部的SQL Server(或任何其他数据库)连接.您需要想出自己的策略来使两个数据库之间的数据保持同步.

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.

这篇关于在SQL Server数据库事务中登记Cosmos事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆