【发布时间】:2013-08-28 13:26:27
【问题描述】:
谁能更新我这个话题?
我想在我的应用程序中同时支持 SQL Server 和 Oracle。
是否可以让以下代码(在 BL 中)同时适用于 SQL Server 和 Oracle,而无需升级/跨越到分布式事务 (DTC)?
// dbcontext is created before, same dbcontext will be used by both repositories
using (var ts = new TransactionScope())
{
// create order - make use of dbcontext, possibly to call SaveChanges here
orderRepository.CreateOrder(order);
// update inventory - make use of same dbcontext, possibly to call SaveChanges here
inventoryRepository.UpdateInventory(inventory);
ts.Complete();
}
截至今天,即 2013 年 8 月底,我知道它适用于 SQL Server 2008+ ......但是 Oracle 呢?我发现了这个thread... 看起来 Oracle 正在推广分布式事务,但我仍然不清楚。
有没有人用实体框架编写应用程序来支持 SQL Server 和 Oracle 的经验来启发我?
谢谢!
更新:最后我注意到 EF6 带有 Improved Transaction Support。除了 Remus 的建议之外,这可能是我的解决方案。
【问题讨论】:
-
或者至少,也许有人告诉我另一个 ORM/Oracle 数据提供者可以用来实现我的目标?
标签: sql oracle entity-framework transactions transactionscope