嵌套事務如果你有服用點是這樣的:用的TransactionScope
IBinaryAssetStructureRepository rep = new BinaryAssetStructureRepository();
var userDto = new UserDto { id = 3345 };
var dto = new BinaryAssetBranchNodeDto("name", userDto, userDto);
using (var scope1 = new TransactionScope())
{
using(var scope2 = new TransactionScope())
{
//Persist to database
rep.CreateRoot(dto, 1, false);
scope2.Complete();
}
scope1.Dispose();
}
dto = rep.GetByKey(dto.id, -1, false);
會內的TransactionScope scope2也被回滾?
此鏈接已損壞。 – adamjford 2012-06-05 16:48:17
你說scope.dispose是多餘的,但更重要的是scope1.dispose回滾事務。 – Mcanic 2016-09-07 09:44:04