|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
TransactionFlowAttribute-Klasse
Namespace: System.ServiceModel
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Der TransactionFlowAttribute-Typ macht die folgenden Member verfügbar.
| Name | Beschreibung | |
|---|---|---|
![]() | TransactionFlowAttribute |
| Name | Beschreibung | |
|---|---|---|
![]() | Transactions | |
![]() | TypeId |
| Name | Beschreibung | |
|---|---|---|
![]() | Equals | Infrastruktur. |
![]() | GetHashCode | |
![]() | GetType | |
![]() | IsDefaultAttribute | |
![]() | Match | |
![]() | ToString |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames | |
![]() ![]() | _Attribute.GetTypeInfo | |
![]() ![]() | _Attribute.GetTypeInfoCount | |
![]() ![]() | _Attribute.Invoke | |
![]() ![]() | IOperationBehavior.AddBindingParameters | |
![]() ![]() | IOperationBehavior.ApplyClientBehavior | |
![]() ![]() | IOperationBehavior.ApplyDispatchBehavior | |
![]() ![]() | IOperationBehavior.Validate |
Hinweis |
|---|
using System;
using System.ServiceModel;
using System.Transactions;
namespace Microsoft.WCF.Documentation
{
[ServiceContract(
Namespace="http://microsoft.wcf.documentation",
SessionMode=SessionMode.Required
)]
public interface IBehaviorService
{
[OperationContract]
[TransactionFlow(TransactionFlowOption.Mandatory)]
string TxWork(string message);
}
// Note: To use the TransactionIsolationLevel property, you
// must add a reference to the System.Transactions.dll assembly.
/* The following service implementation:
* -- Processes messages on one thread at a time
* -- Creates one service object per session
* -- Releases the service object when the transaction commits
*/
[ServiceBehavior(
ConcurrencyMode=ConcurrencyMode.Single,
InstanceContextMode=InstanceContextMode.PerSession,
ReleaseServiceInstanceOnTransactionComplete=true
)]
public class BehaviorService : IBehaviorService, IDisposable
{
Guid myID;
public BehaviorService()
{
myID = Guid.NewGuid();
Console.WriteLine(
"Object "
+ myID.ToString()
+ " created.");
}
/*
/ * The following operation-level behaviors are specified:
/ * Always executes under a transaction scope.
/ * The transaction scope is completed when the operation
/ * terminates without an unhandled exception.
/*
[OperationBehavior(
TransactionAutoComplete = true,
TransactionScopeRequired = true
)]
public string TxWork(string message)
{
// Do some transactable work.
Console.WriteLine("TxWork called with: " + message);
// Display transaction information.
TransactionInformation info = Transaction.Current.TransactionInformation;
Console.WriteLine("The distributed tx ID: {0}.", info.DistributedIdentifier);
Console.WriteLine("The tx status: {0}.", info.Status);
return String.Format("Hello. This was object {0}.",myID.ToString()) ;
}
public void Dispose()
{
Console.WriteLine(
"Service "
+ myID.ToString()
+ " is being recycled."
);
}
}
}
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core-Rolle wird nicht unterstützt), Windows Server 2008 R2 (Server Core-Rolle wird mit SP1 oder höher unterstützt; Itanium wird nicht unterstützt)
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
