사용하십시오 TransactionScope
객체와 다른 연결 (각 데이터베이스에 대해 하나). 트랜잭션은 자동으로 분산 된 트랜잭션으로 전달됩니다.
using (TransactionScope scope = new TransactionScope())
{
using (SqlConnection connection1 = new SqlConnection(connectString1))
{
// Opening the connection automatically enlists it in the
// TransactionScope as a lightweight transaction.
connection1.Open();
using (SqlConnection connection2 = new SqlConnection(connectString2))
{
// The transaction is escalated to a full distributed
// transaction when connection2 is opened.
connection2.Open();
}
}
scope.Complete();
}
다음 MSDN 페이지의 예에서