ILinkedUndoContext.BeginTransaction 메서드

변경 하 여 모델을 그룹화 합니다.모든 변경 내용이 실패 하면 모델이 변경 되지 않은 상태로 전체 그룹을 중단할 수 있습니다.트랜잭션을 완료 하려면 commit()를 호출 합니다.사용자가 호출 하면 전체 그룹이 롤백됩니다.

네임스페이스:  Microsoft.VisualStudio.Modeling.ExtensionEnablement
어셈블리:  Microsoft.VisualStudio.Modeling.Sdk.11.0(Microsoft.VisualStudio.Modeling.Sdk.11.0.dll)

구문

‘선언
Function BeginTransaction ( _
    description As String _
) As ILinkedUndoTransaction
ILinkedUndoTransaction BeginTransaction(
    string description
)

매개 변수

  • description
    형식: System.String
    트랜잭션을 식별 하는 문자열입니다.

반환 값

형식: Microsoft.VisualStudio.Modeling.ExtensionEnablement.ILinkedUndoTransaction
새 트랜잭션입니다.변경을 완료 하는 경우 커밋 또는 중단,이 거래를 처리 하 고 있습니다.

설명

이니셜라이저에이 작업을 수행할에 using 절 변경 내용이 완료 되 면 트랜잭션이 삭제 되는지 확인 합니다.

내부 catch 되지 않는 예외는 using 블록 안에 롤백됩니다 모든 UML 모델 변경 하면.Note이 UML 모델에 변경 내용 및 다른 변수, 외부 데이터베이스, 파일 및 방식에 대 한 변경 내용이 없습니다 적용 합니다.

트랜잭션은 중첩할 수 있습니다.

자세한 내용은 방법: 트랜잭션을 사용하여 모델 업데이트 연결를 참조하십시오.

예제

try
{
  using (ILinkedUndoTransaction transaction =
              LinkedUndoContext.BeginTransaction("Swap names"))
  { 
    Operation1(); 
    Operation2();
    // Any exception in the preceding statements
    // will undo all of the changes in the model.
    transaction.Commit(); // Always remember Commit()!
  }
}
catch ()
{
    // If control reaches here,
    // Operation1 and Operation2 have
    // made no change to the model.
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

ILinkedUndoContext 인터페이스

Microsoft.VisualStudio.Modeling.ExtensionEnablement 네임스페이스