TransactionAttribute 构造函数

定义

初始化 TransactionAttribute 类的新实例。

重载

TransactionAttribute()

初始化 TransactionAttribute 类的新实例,并且将组件的请求的事务类型设置为 Required

TransactionAttribute(TransactionOption)

初始化 TransactionAttribute 类的新实例,并且指定事务类型。

TransactionAttribute()

初始化 TransactionAttribute 类的新实例,并且将组件的请求的事务类型设置为 Required

public:
 TransactionAttribute();
public TransactionAttribute ();
Public Sub New ()

示例

下面的代码示例创建新的 TransactionAttribute

[Transaction]
public class TransactionAttribute_Ctor : ServicedComponent
{
}
<Transaction()>  _
Public Class TransactionAttribute_Ctor
    Inherits ServicedComponent
End Class

适用于

TransactionAttribute(TransactionOption)

初始化 TransactionAttribute 类的新实例,并且指定事务类型。

public:
 TransactionAttribute(System::EnterpriseServices::TransactionOption val);
public TransactionAttribute (System.EnterpriseServices.TransactionOption val);
new System.EnterpriseServices.TransactionAttribute : System.EnterpriseServices.TransactionOption -> System.EnterpriseServices.TransactionAttribute
Public Sub New (val As TransactionOption)

参数

val
TransactionOption

指定的事务类型,一个 TransactionOption 值。

示例

下面的代码示例创建新的 TransactionAttribute

[Transaction(TransactionOption.Supported)]
public class TransactionAttribute_Ctor_TransactionOption : ServicedComponent
{
}

[Transaction(TransactionOption.Supported,
     Isolation=TransactionIsolationLevel.Serializable)]
public class TransactionAttribute_Ctor_TransactionOption_Isolation :
    ServicedComponent
{
}

[Transaction(TransactionOption.Supported,
     Isolation=TransactionIsolationLevel.Serializable,
     Timeout=30)]
public class TransactionAttribute_Ctor_TransactionOption_Isolation_Timeout :
     ServicedComponent
{
}
<Transaction(TransactionOption.Supported)>  _
Public Class TransactionAttribute_Ctor_TransactionOption
    Inherits ServicedComponent
End Class

<Transaction(TransactionOption.Supported, Isolation := TransactionIsolationLevel.Serializable)>  _
Public Class TransactionAttribute_Ctor_TransactionOption_Isolation
    Inherits ServicedComponent
End Class

<Transaction(TransactionOption.Supported, Isolation := TransactionIsolationLevel.Serializable, Timeout := 30)>  _
Public Class TransactionAttribute_Ctor_TransactionOption_Isolation_Timeout
    Inherits ServicedComponent
End Class

适用于