ModelEditingScope ModelEditingScope ModelEditingScope ModelEditingScope Class


表示對編輯存放區的一組變更。Represents a group of changes to the editing store. 變更群組為可交易。Change groups are transactional. 在編輯範圍下所做的變更可以整批認可或中止。The changes made under an editing scope can be committed or aborted as a unit.

public ref class ModelEditingScope abstract : IDisposable
public abstract class ModelEditingScope : IDisposable
type ModelEditingScope = class
    interface IDisposable
Public MustInherit Class ModelEditingScope
Implements IDisposable


認可編輯範圍時,編輯存放區會取得其中發生的所有變更並套用至模型。When an editing scope is committed, the editing store takes all changes that occurred within it and applies them to the model. 如果呼叫編輯範圍的Revert方法, 或在呼叫之前Complete處置編輯範圍, 編輯範圍會改為反轉對基礎物件所做的變更, 並從編輯存放區重新套用狀態。If the editing scope's Revert method is called, or the editing scope is disposed of before Complete is called, the editing scope will instead reverse the changes made to the underlying objects, reapplying state from the editing store. 這為復原機制提供穩固的基礎。This provides a solid basis for an undo mechanism.


ModelEditingScope() ModelEditingScope() ModelEditingScope() ModelEditingScope()

建立新的 ModelEditingScopeCreates a new ModelEditingScope.


Description Description Description Description

描述變更群組。Describes the group of changes. 它可在認可變更之前隨時加以變更。It can be changed anytime before the changes are committed.


CanComplete() CanComplete() CanComplete() CanComplete()

判斷是否應呼叫 OnComplete(),或者應該還原變更。Determines whether OnComplete() should be called, or whether the change should instead be reverted. 還原的原因可能包括無法從原始檔控制系統簽出檔案以進行修改。Reasons for reverting might include a file cannot be checked out of a source control system for modification.

Complete() Complete() Complete() Complete()

藉由呼叫 OnComplete() 方法完成編輯範圍。Completes the editing scope by calling the OnComplete() method.

Dispose() Dispose() Dispose() Dispose()

中止變更以處置這個物件,除非編輯範圍已經完成或還原。Disposes of this object by aborting changes unless the editing scope has already been completed or reverted.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

中止變更以處置這個物件。Disposes of this object by aborting changes.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnComplete() OnComplete() OnComplete() OnComplete()

執行編輯範圍的實際完成。Performs the actual complete of the editing scope.

OnException(Exception) OnException(Exception) OnException(Exception) OnException(Exception)

處理例外狀況。Handles an exception.

OnRevert(Boolean) OnRevert(Boolean) OnRevert(Boolean) OnRevert(Boolean)

執行編輯範圍的實際還原。Performs the actual revert of the editing scope.

Revert() Revert() Revert() Revert()

放棄在編輯範圍期間所做的變更。Abandons the changes made during the editing scope.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)