在实体框架中更新单个事务中的多个对象 [英] Updating multiple objects in single transaction in entity framework

查看:85
本文介绍了在实体框架中更新单个事务中的多个对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单一上下文中使用实体框架添加一组对象,但是希望在一个事务中。我可以这样做吗?

解决方案

你可以看一下如何:管理实体框架中的事务 MSDN上的文章。基本上您将使用 TransactionScope 类来界定边界的交易。


I'm adding a set of objects using entity framework in single context but want to be in a transaction. How I can do that?

解决方案

You may take a look at the How to: Manage Transactions in the Entity Framework article on MSDN. Basically you would use the TransactionScope class to demarcate the boundaries of the transaction.

这篇关于在实体框架中更新单个事务中的多个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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