ILinkedUndoTransaction 介面
交易讓您群組在一起的作業,在 [UML 模型存放區中,因此,如果其中任一個均會失敗,就會回復整個群組。交易認可後,使用者可以復原單一的復原指令的整個群組。
命名空間: Microsoft.VisualStudio.Modeling.ExtensionEnablement
組件: Microsoft.VisualStudio.Modeling.Sdk.11.0 (在 Microsoft.VisualStudio.Modeling.Sdk.11.0.dll 中)
語法
'宣告
Public Interface ILinkedUndoTransaction _
Inherits IDisposable
public interface ILinkedUndoTransaction : IDisposable
ILinkedUndoTransaction 型別會公開下列成員。
屬性
名稱 | 說明 | |
---|---|---|
![]() |
Id | 此交易的名稱來設定BeginTransaction。 |
回頁首
方法
名稱 | 說明 | |
---|---|---|
![]() |
Abort | 復原所有變更至模型的儲存區交易的建立之後所發生的。處置交易,而不認可它有相同的效果。中止,不會復原到其他的程式變數或外部資源的變更。 |
![]() |
Commit | 完成的交易,讓它處置時,在其中執行的作業將無法復原。 |
![]() |
Dispose | 執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。 (繼承自 IDisposable)。 |
回頁首
備註
在Visual Studio副檔名,您可以從中取得內容ILinkedUndoTransaction可以建立方式如下:
[Import]
public ILinkedUndoContext LinkedUndoContext { get; set; }
在方法中,您可以建立從本文中的交易:
using (ILinkedUndoTransaction transaction =
LinkedUndoContext.BeginTransaction("Swap names"))
{
Operation1();
Operation2();
transaction.Commit(); // Always remember Commit()!
}
在未被攔截的例外狀況using區塊會造成所有 UML 模型的變更都設定成會復原。請注意這會發生只以變更在 [UML 模型中,而不是對其他的變數、 外部資料庫、 檔案等等所做的變更。
可以是巢狀交易。
如需詳細資訊,請參閱 HOW TO:使用交易連結模型更新。