트랜잭션 처리를 처음으로 수행하기 때문에 트랜잭션 스코프에 대한 의문점이 있습니다 (데이터베이스 기반 트랜잭션을 삽입 및 업데이트하는 트랜잭션). 전체 트랜잭션 (XML)의 결과.트랜잭션 작업을위한 중첩 된 트랜잭션 범위
XML을 얻은 후에 고객이 내 시스템을 통합하기 위해 웹 서비스에 XML을 전송합니다.
요점은 고객이 노출하는 WS가 IT 분야에서 수행하는 주간 또는 월간 지원 작업으로 인해 추락한다고 생각해 봅니다. 그래서 나는 모든 것을 수행합니다. DB 작업을 수행하지만 물론 수행합니다 나는 WS를 호출하려고 할 때 예외를 던질 것이다.
인터넷에서 검색 한 후 Transaction Scope에 대해 생각하기 시작했습니다. 내 데이터 액세스 계층에 내 데이터 액세스 방법은 이미 내가 삽입, 업데이트, 삭제 수행합니다 TransactionScope에 등을 가지고
다음 코드는 내가 시도하고 싶은 무엇인가
public void ProcessSomething()
{
using (TransactionScope mainScope = new TransactionScope())
{
FooDAL dl = new FooDAL();
string message = dl.ProcessTransaction();
WSClientFoo client = new WSClientFoo();
client.SendTransactionMessage(message);
mainScope.Complete();
}
}
public class FooDAL
{
public string ProcessTransaction()
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions(){ IsolationLevel = IsolationLevel.ReadCommitted}))
{
///Do Insert, Update, Delete and According to the Operation Generates a message
scope.Complete();
}
return transactionMessage;
}
}
을 질문은, 내가 뭘하고 싶은지 처리하기 위해 TransactionScope를 사용하는 것이 맞습니까?
감사는 FooDAL.ProcessTransaction 방법에서 당신의 시간 :