-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
TransactionFlowAttribute.xml
332 lines (308 loc) · 23.4 KB
/
TransactionFlowAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<Type Name="TransactionFlowAttribute" FullName="System.ServiceModel.TransactionFlowAttribute">
<TypeSignature Language="C#" Value="public sealed class TransactionFlowAttribute : Attribute, System.ServiceModel.Description.IOperationBehavior" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit TransactionFlowAttribute extends System.Attribute implements class System.ServiceModel.Description.IOperationBehavior" />
<TypeSignature Language="DocId" Value="T:System.ServiceModel.TransactionFlowAttribute" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class TransactionFlowAttribute
Inherits Attribute
Implements IOperationBehavior" />
<TypeSignature Language="F#" Value="type TransactionFlowAttribute = class
 inherit Attribute
 interface IOperationBehavior" />
<TypeSignature Language="C++ CLI" Value="public ref class TransactionFlowAttribute sealed : Attribute, System::ServiceModel::Description::IOperationBehavior" />
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.ServiceModel.Description.IOperationBehavior</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Method)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Method)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Specifies whether a service operation accepts incoming transactions from a client.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.ServiceModel.TransactionFlowAttribute> is an attribute used declaratively to associate a specific transaction flow policy with a service operation. The <xref:System.ServiceModel.TransactionFlowOption> property of this attribute specifies whether the respective operation accepts a transaction flowed from the client, or if the operation requires the client to always flow a transaction. The <xref:System.ServiceModel.TransactionFlowAttribute> can also be used as an operation behavior to programmatically associate a transaction flow policy with a specific operation. In this case, it should be added to the `Behaviors` collection on the operation's description.
> [!NOTE]
> The `OperationContract` for each method that uses the <xref:System.ServiceModel.TransactionFlowAttribute> must provide a fully-qualified `Action` string. A value of "*" is not supported.
## Examples
The following code example shows the use of this enumeration together with the <xref:System.ServiceModel.TransactionFlowOption> class at the operation level.
```
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."
);
}
}
}
```
]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/wcf/feature-details/enabling-transaction-flow">Enabling Transaction Flow</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public TransactionFlowAttribute (System.ServiceModel.TransactionFlowOption transactions);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.ServiceModel.TransactionFlowOption transactions) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ServiceModel.TransactionFlowAttribute.#ctor(System.ServiceModel.TransactionFlowOption)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (transactions As TransactionFlowOption)" />
<MemberSignature Language="F#" Value="new System.ServiceModel.TransactionFlowAttribute : System.ServiceModel.TransactionFlowOption -> System.ServiceModel.TransactionFlowAttribute" Usage="new System.ServiceModel.TransactionFlowAttribute transactions" />
<MemberSignature Language="C++ CLI" Value="public:
 TransactionFlowAttribute(System::ServiceModel::TransactionFlowOption transactions);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="transactions" Type="System.ServiceModel.TransactionFlowOption" />
</Parameters>
<Docs>
<param name="transactions">A <see cref="T:System.ServiceModel.TransactionFlowOption" />.</param>
<summary>Initializes a new instance of the <see cref="T:System.ServiceModel.TransactionFlowAttribute" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows the use of this enumeration together with the <xref:System.ServiceModel.TransactionFlowOption> class at the operation level.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/operationbehaviorattribute1/cs/services.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/operationbehaviorattribute1/vb/services.vb" id="Snippet2":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.ServiceModel.Description.IOperationBehavior.AddBindingParameters">
<MemberSignature Language="C#" Value="void IOperationBehavior.AddBindingParameters (System.ServiceModel.Description.OperationDescription description, System.ServiceModel.Channels.BindingParameterCollection parameters);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(class System.ServiceModel.Description.OperationDescription description, class System.ServiceModel.Channels.BindingParameterCollection parameters) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ServiceModel.TransactionFlowAttribute.System#ServiceModel#Description#IOperationBehavior#AddBindingParameters(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Channels.BindingParameterCollection)" />
<MemberSignature Language="VB.NET" Value="Sub AddBindingParameters (description As OperationDescription, parameters As BindingParameterCollection) Implements IOperationBehavior.AddBindingParameters" />
<MemberSignature Language="F#" Value="abstract member System.ServiceModel.Description.IOperationBehavior.AddBindingParameters : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Channels.BindingParameterCollection -> unit
override this.System.ServiceModel.Description.IOperationBehavior.AddBindingParameters : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Channels.BindingParameterCollection -> unit" Usage="transactionFlowAttribute.System.ServiceModel.Description.IOperationBehavior.AddBindingParameters (description, parameters)" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(System::ServiceModel::Description::OperationDescription ^ description, System::ServiceModel::Channels::BindingParameterCollection ^ parameters) = System::ServiceModel::Description::IOperationBehavior::AddBindingParameters;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Channels.BindingParameterCollection)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="description" Type="System.ServiceModel.Description.OperationDescription" />
<Parameter Name="parameters" Type="System.ServiceModel.Channels.BindingParameterCollection" />
</Parameters>
<Docs>
<param name="description">The operation description for which the attribute adds extra functionality.</param>
<param name="parameters">The collection of parameter objects on the binding context.</param>
<summary>Adds extra parameters (settings) to the binding context to support this operation's behavior. This method cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method provides a binding context with the extra parameters (settings) to support the required behavior for this operation. It is called internally by the infrastructure when a service is created.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior">
<MemberSignature Language="C#" Value="void IOperationBehavior.ApplyClientBehavior (System.ServiceModel.Description.OperationDescription description, System.ServiceModel.Dispatcher.ClientOperation proxy);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(class System.ServiceModel.Description.OperationDescription description, class System.ServiceModel.Dispatcher.ClientOperation proxy) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ServiceModel.TransactionFlowAttribute.System#ServiceModel#Description#IOperationBehavior#ApplyClientBehavior(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Dispatcher.ClientOperation)" />
<MemberSignature Language="VB.NET" Value="Sub ApplyClientBehavior (description As OperationDescription, proxy As ClientOperation) Implements IOperationBehavior.ApplyClientBehavior" />
<MemberSignature Language="F#" Value="abstract member System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Dispatcher.ClientOperation -> unit
override this.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Dispatcher.ClientOperation -> unit" Usage="transactionFlowAttribute.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior (description, proxy)" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(System::ServiceModel::Description::OperationDescription ^ description, System::ServiceModel::Dispatcher::ClientOperation ^ proxy) = System::ServiceModel::Description::IOperationBehavior::ApplyClientBehavior;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Dispatcher.ClientOperation)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="description" Type="System.ServiceModel.Description.OperationDescription" />
<Parameter Name="proxy" Type="System.ServiceModel.Dispatcher.ClientOperation" />
</Parameters>
<Docs>
<param name="description">The operation to which the attribute attaches functionality.</param>
<param name="proxy">The <see cref="T:System.ServiceModel.Dispatcher.ClientOperation" /> object that represents the current operation.</param>
<summary>Attaches the attribute functionality to the <see langword="ProxyOperation" /> object for the method that the attribute marks. This method cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method allows you to view, modify, or add custom extensions to the client runtime across all messages, or for a specific operation. Note that in the case of the <xref:System.ServiceModel.TransactionFlowAttribute>, the implementation of this method is empty. This method is called internally by the infrastructure when a service proxy is created.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior">
<MemberSignature Language="C#" Value="void IOperationBehavior.ApplyDispatchBehavior (System.ServiceModel.Description.OperationDescription description, System.ServiceModel.Dispatcher.DispatchOperation dispatch);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior(class System.ServiceModel.Description.OperationDescription description, class System.ServiceModel.Dispatcher.DispatchOperation dispatch) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ServiceModel.TransactionFlowAttribute.System#ServiceModel#Description#IOperationBehavior#ApplyDispatchBehavior(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Dispatcher.DispatchOperation)" />
<MemberSignature Language="VB.NET" Value="Sub ApplyDispatchBehavior (description As OperationDescription, dispatch As DispatchOperation) Implements IOperationBehavior.ApplyDispatchBehavior" />
<MemberSignature Language="F#" Value="abstract member System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Dispatcher.DispatchOperation -> unit
override this.System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior : System.ServiceModel.Description.OperationDescription * System.ServiceModel.Dispatcher.DispatchOperation -> unit" Usage="transactionFlowAttribute.System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior (description, dispatch)" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior(System::ServiceModel::Description::OperationDescription ^ description, System::ServiceModel::Dispatcher::DispatchOperation ^ dispatch) = System::ServiceModel::Description::IOperationBehavior::ApplyDispatchBehavior;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.OperationDescription,System.ServiceModel.Dispatcher.DispatchOperation)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="description" Type="System.ServiceModel.Description.OperationDescription" />
<Parameter Name="dispatch" Type="System.ServiceModel.Dispatcher.DispatchOperation" />
</Parameters>
<Docs>
<param name="description">The description for this operation.</param>
<param name="dispatch">The <see cref="T:System.ServiceModel.Dispatcher.DispatchOperation" /> object for this operation.</param>
<summary>Attaches the attribute functionality to the <see cref="T:System.ServiceModel.Dispatcher.DispatchOperation" /> object for the method that the attribute marks. This method cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method allows you to view, modify, or add custom extensions to the client runtime across all messages, or for a specific operation. Note that in the case of the <xref:System.ServiceModel.TransactionFlowAttribute>, the implementation of this method is empty. This method is called internally by the infrastructure when a service is created.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.ServiceModel.Description.IOperationBehavior.Validate">
<MemberSignature Language="C#" Value="void IOperationBehavior.Validate (System.ServiceModel.Description.OperationDescription description);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.ServiceModel.Description.IOperationBehavior.Validate(class System.ServiceModel.Description.OperationDescription description) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ServiceModel.TransactionFlowAttribute.System#ServiceModel#Description#IOperationBehavior#Validate(System.ServiceModel.Description.OperationDescription)" />
<MemberSignature Language="VB.NET" Value="Sub Validate (description As OperationDescription) Implements IOperationBehavior.Validate" />
<MemberSignature Language="F#" Value="abstract member System.ServiceModel.Description.IOperationBehavior.Validate : System.ServiceModel.Description.OperationDescription -> unit
override this.System.ServiceModel.Description.IOperationBehavior.Validate : System.ServiceModel.Description.OperationDescription -> unit" Usage="transactionFlowAttribute.System.ServiceModel.Description.IOperationBehavior.Validate description" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.ServiceModel.Description.IOperationBehavior.Validate(System::ServiceModel::Description::OperationDescription ^ description) = System::ServiceModel::Description::IOperationBehavior::Validate;" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ServiceModel.Description.IOperationBehavior.Validate(System.ServiceModel.Description.OperationDescription)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="description" Type="System.ServiceModel.Description.OperationDescription" />
</Parameters>
<Docs>
<param name="description">The operation to validate.</param>
<summary>Verifies that the operation can support this behavior. This method cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method verifies whether the operation description is sufficient to support the transaction flow behavior. Note that in the case of the <xref:System.ServiceModel.TransactionFlowAttribute>, the implementation of this method is empty. This method is called internally by the infrastructure when a service is created.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Transactions">
<MemberSignature Language="C#" Value="public System.ServiceModel.TransactionFlowOption Transactions { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.ServiceModel.TransactionFlowOption Transactions" />
<MemberSignature Language="DocId" Value="P:System.ServiceModel.TransactionFlowAttribute.Transactions" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Transactions As TransactionFlowOption" />
<MemberSignature Language="F#" Value="member this.Transactions : System.ServiceModel.TransactionFlowOption" Usage="System.ServiceModel.TransactionFlowAttribute.Transactions" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::ServiceModel::TransactionFlowOption Transactions { System::ServiceModel::TransactionFlowOption get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.ServiceModel</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ServiceModel.TransactionFlowOption</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether the incoming transaction is supported.</summary>
<value>A <see cref="T:System.ServiceModel.TransactionFlowOption" /> that indicates whether the incoming transaction is supported.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>