使用单一事务EF 6添加,更新和删除?

时间:2022-07-08 20:11:06

I have method which has following signature

我有跟随签名的方法

performAmmend(Project project, List witem, List cConfig)

performAmmend(项目项目,列表witem,列表cConfig)

the relationship is Project->WorkItem ( 1 to many) WorkItem->CustomConfig( 1 to many )

关系是Project-> WorkItem(1到多个)WorkItem-> CustomConfig(1到多个)

List parameter could have some new entries, modified or deleted

列表参数可能包含一些新条目,已修改或已删除

How to perform update operation for the project using transaction? i am using code first approch in Entity framework 6.x.

如何使用事务执行项目的更新操作?我在实体框架6.x中使用代码第一个approch。

1 个解决方案

#1


0  

EF will give you a transaction by default. So simply setup your object graph and apply SaveChanges(). OK, deep object graphs aren't simple, but you could use a tool like graphdiff

EF默认会为您提供交易。因此,只需设置对象图并应用SaveChanges()即可。好的,深度对象图并不简单,但您可以使用graphdiff之类的工具

#1


0  

EF will give you a transaction by default. So simply setup your object graph and apply SaveChanges(). OK, deep object graphs aren't simple, but you could use a tool like graphdiff

EF默认会为您提供交易。因此,只需设置对象图并应用SaveChanges()即可。好的,深度对象图并不简单,但您可以使用graphdiff之类的工具