TransactionAttribute Constructors

Definition

Initializes a new instance of the TransactionAttribute class.

Overloads

TransactionAttribute()

Initializes a new instance of the TransactionAttribute class, setting the component's requested transaction type to Required.

TransactionAttribute(TransactionOption)

Initializes a new instance of the TransactionAttribute class, specifying the transaction type.

TransactionAttribute()

Initializes a new instance of the TransactionAttribute class, setting the component's requested transaction type to Required.

C#
public TransactionAttribute();

Examples

The following code example creates a new TransactionAttribute.

C#
[Transaction]
public class TransactionAttribute_Ctor : ServicedComponent
{
}

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

TransactionAttribute(TransactionOption)

Initializes a new instance of the TransactionAttribute class, specifying the transaction type.

C#
public TransactionAttribute(System.EnterpriseServices.TransactionOption val);

Parameters

val
TransactionOption

The specified transaction type, a TransactionOption value.

Examples

The following code example creates a new TransactionAttribute.

C#
[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
{
}

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1