Transaction 類別

定義

表示交易。

public ref class Transaction : IDisposable, System::Runtime::Serialization::ISerializable
public class Transaction : IDisposable, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class Transaction : IDisposable, System.Runtime.Serialization.ISerializable
type Transaction = class
    interface IDisposable
    interface ISerializable
[<System.Serializable>]
type Transaction = class
    interface IDisposable
    interface ISerializable
Public Class Transaction
Implements IDisposable, ISerializable
繼承
Transaction
衍生
屬性
實作

備註

System.Transactions 命名空間會提供根據 Transaction 類別的明確程式撰寫模型 (Programming Model),以及使用 TransactionScope 類別的隱含程式撰寫模型,而其中異動會由基礎結構自動管理。 強烈建議您使用較簡單的隱含模型進行開發。 若要開始使用,請參閱 使用交易範圍實作隱含交易 主題。 如需撰寫交易式應用程式的詳細資訊,請參閱 撰寫交易式應用程式

類別 Transaction 包含由實作資源管理員以進行登記的開發人員所使用的方法。 它也提供複製交易及控制目前交易內容的功能。 如果使用靜態 Current 屬性來設定目前交易,您可以取得目前的交易。

屬性

Current

取得或設定環境交易。

IsolationLevel

取得交易的隔離等級 (Isolation Level)。

PromoterType

可唯一識別 byte[] 的格式,其由 Promote 方法在交易升級時傳回。

TransactionInformation

擷取交易的其他資訊。

方法

Clone()

建立交易的複製品 (Clone)。

DependentClone(DependentCloneOption)

建立交易的相依複製品。

Dispose()

釋放該物件所持有的資源。

EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions)

登記支援兩階段交易認可 (Two-Phase Commit) 的長期資源管理員以參與交易。

EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions)

登記支援單一階段交易認可最佳化的長期資源管理員以參與交易。

EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification)

使用可提升單一階段登記 (PSPE) 來登記具有內部交易的資源管理員。

EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification, Guid)

使用可提升單一階段登記 (PSPE) 來登記具有內部交易的資源管理員。

EnlistVolatile(IEnlistmentNotification, EnlistmentOptions)

登錄暫時性資源管理員,支援兩階段交易認可參與交易。

EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions)

登記支援單一階段交易認可最佳化的暫時性 (Volatile) 資源管理員以參與交易。

Equals(Object)

判斷這個交易和指定的物件是否相等。

GetHashCode()

傳回這個執行個體的雜湊碼。

GetPromotedToken()

byte[]取得升級交易時,方法所傳 Promote 回的 。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
PromoteAndEnlistDurable(Guid, IPromotableSinglePhaseNotification, ISinglePhaseNotification, EnlistmentOptions)

提升和登記支援兩階段交易認可 (Two-Phase Commit) 的長期資源管理員以參與異動。

Rollback()

復原 (中止) 交易。

Rollback(Exception)

復原 (中止) 交易。

SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid)

設定非 MSDTC Promoter 所產生的分散式異動識別碼。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

運算子

Equality(Transaction, Transaction)

測試兩個指定的 Transaction 執行個體是否相等。

Inequality(Transaction, Transaction)

傳回值,這個值表示兩個 Transaction 執行個體是否不相等。

事件

TransactionCompleted

指出交易已完成。

明確介面實作

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

取得 SerializationInfo,其中含有序列化這個交易所需的資料。

適用於

執行緒安全性

此型別具備執行緒安全。

另請參閱