ServiceBehaviorAttribute::ReleaseServiceInstanceOnTransactionComplete Property
Gets or sets a value that specifies whether the service object is released when the current transaction completes.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
public: property bool ReleaseServiceInstanceOnTransactionComplete { bool get(); void set(bool value); }
Property Value
Type: System::Booleantrue if the service object is to be released; otherwise, false. The default is true.
Note that you must explicitly set ReleaseServiceInstanceOnTransactionComplete to false if there is an operation with OperationBehaviorAttribute::TransactionScopeRequired set to true and you set ConcurrencyMode to Reentrant. Otherwise a validation exception is thrown because the default value of ReleaseServiceInstanceOnTransactionComplete is true.
In addition, it is important to realize that if the service is created by passing a service object to the ServiceHost::ServiceHost(Object^, array<Uri^>^) constructor, the value of this property is treated as if it were false.
The following code example sets the transaction isolation level to ReadCommitted, disables support for concurrent transactions, requires a flowed transaction from the operation call, and commits the transaction on the service automatically if no unhandled exception occurs.
The underlying binding must support flowed transactions for the following code example to execute properly. To support flowed transactions using the WSHttpBinding, for example, set the TransactionFlow property to true in code or in an application configuration file. The following code example shows a configuration file for the preceding sample.
Available since 3.0