24 March 2014

Transaction Mode

This article explains about the how to configure the service and client transaction mode in WCF service.
  • Client transaction – Transaction setting propagated or initiated from the client side
  • Server transaction – Transaction setting propagated or initiated from server side

Client/Server transaction mode:

    This setting ensures that service uses the client’s transaction if possible or a server side transaction when the client does not have a transaction.
  1. Enable the TransactionFlow=true in binding configuration
  2. Set TransactionFlowOption.Allowed in the operation contract
  3. Set TransactionScopeRequired=true in the operation contract
Client transaction mode:

    This settings ensures the service uses only the client’s transaction
  1. Enable the TransactionFlow=true in binding configuration
  2. Set TransactionFlowOption. Mandatory in the operation contract
  3. Set TransactionScopeRequired=true in the operation contract
Service transaction mode:

    This seeing ensures that the service always has a transaction, separated from any transaction its client may or may not have.
  1. Disable the TransactionFlow=false in binding configuration
  2. Set TransactionFlowOption. NotAllowed in the operation contract
  3. Set TransactionScopeRequired=true in the operation contract
None transaction mode:

    This setting ensures service does not use transaction
  1. Disable the TransactionFlow=false in binding configuration
  2. Set TransactionFlowOption. NotAllowed in the operation contract
  3. Set TransactionScopeRequired=false in the operation contract 
Below table explains about the Transaction mode activation based on the binging, contract and behavior settings

Binding Transaction flow
TransactionFlowOption
TransactionScopeRequired
Transaction mode
False
Allowed
False
None
False
Allowed
True
Service
False
NotAllowed
False
None
False
Allowed
True
Service
True
Allowed
False
None
True
Allowed
True
Client/Service
True
Mandatory
False
None
True
Mandatory
True
Client


 
     

No comments:

Post a Comment