using (TransactionScope scope = new TransactionScope())
{
int updatedRows1 = custPh.Update(cust.CustomerID, tempPh1, 0);
int updatedRows2 = custPh.Update(cust.CustomerID, tempPh2, 1);
int updatedRows3 = cust.Update();
if (updatedRows1 > 0 && updatedRows2 > 0 && updatedRows3 > 0)
{
scope.Complete();
}
}
위의 TransactionScope 코드가 올바르게 구성되어 있습니까? 이것은 내가 그것을 할 수있는만큼 간단하게하려고 노력하고 그래서 그것을 사용하여 처음입니다.질문 .NET의 TransactionScope 정보
잘 사용하고 있습니다. 요구 사항에 따라 주변 트랜잭션에 참여하거나 참여하지 않도록 할 수 있습니다. TransactionOptions 매개 변수로이를 설정합니다. http://simpleverse.wordpress.com/2008/08/05/using-transactionscope-for-handling-transactions/ –
@Mike. 올바른 것이므로 답을 만들어야합니다. – Steven
실제로 나는 그 기사가 시대에 뒤진 Mike 일 것 같다고 생각합니다. TransactionScope는 더 이상 DTC를 감싸는 래퍼가 아니며 훨씬 더 유용합니다. http://stackoverflow.com/questions/1155941/transactionscope-has-it-gotten-better –