|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
OperationBehaviorAttribute-Klasse
Namespace: System.ServiceModel
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Der OperationBehaviorAttribute-Typ macht die folgenden Member verfügbar.
| Name | Beschreibung | |
|---|---|---|
![]() | OperationBehaviorAttribute |
| Name | Beschreibung | |
|---|---|---|
![]() | AutoDisposeParameters | |
![]() | Impersonation | |
![]() | ReleaseInstanceMode | |
![]() | TransactionAutoComplete | |
![]() | TransactionScopeRequired | |
![]() | 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 |
|---|
Die AutoDisposeParameters-Eigenschaft steuert, ob an einen Vorgang übergebene Parameterobjekte verworfen werden, wenn der Vorgang abgeschlossen ist. Die TransactionAutoComplete-Eigenschaft legt fest, ob die Transaktion, in der die Methode ausgeführt wird, automatisch ausgeführt wird, wenn keine nicht behandelten Ausnahmen ausgelöst werden. Die TransactionScopeRequired-Eigenschaft gibt an, ob eine Methode innerhalb einer Transaktion ausgeführt werden muss. Die Impersonation-Eigenschaft gibt an, ob der Dienstvorgang die Identität des Aufrufers annehmen kann, annehmen muss oder nicht annehmen kann. Die ReleaseInstanceMode-Eigenschaft gibt an, wann Dienstobjekte während des Methodenaufrufprozesses wiederverwendet werden.
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] 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 )] [TransactionFlow(TransactionFlowOption.Mandatory)] 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.
