Skip to Content
Programming WCF Services, 3rd Edition
book

Programming WCF Services, 3rd Edition

by Juval Lowy
August 2010
Intermediate to advanced
908 pages
26h 22m
English
O'Reilly Media, Inc.
Content preview from Programming WCF Services, 3rd Edition

Transaction Propagation

WCF can propagate transactions across the service boundary. This enables a service to participate in a client’s transaction, and the client to include operations on multiple services in the same transaction. The client itself may or may not be a WCF service. Both the binding and the operation contract configuration control the decision as to whether or not the client’s transaction is propagated to the service. I call any binding that is capable of propagating the client’s transaction to the service if configured to do so a transaction-aware binding. Only the TCP, IPC, and WS bindings are transaction-aware.

Transaction Flow and Bindings

By default, transaction-aware bindings do not propagate transactions. The reason is that, like most everything else in WCF, this is an opt-in setting: the service host or administrator has to explicitly give its consent to accepting incoming transactions, potentially from across the organization or the business boundaries. To propagate a transaction, you must explicitly enable it in the binding on both the service host and client sides. All transaction-aware bindings offer the Boolean property TransactionFlow, such as:

public class NetTcpBinding : Binding,...
{
   public bool TransactionFlow
   {get;set;}
   //More members
}

TransactionFlow defaults to false. To enable propagation, simply set this property to true, either programmatically or in the host config file. For example, in the case of the TCP binding:

NetTcpBinding tcpBinding = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming WCF Services, 4th Edition

Programming WCF Services, 4th Edition

Juval Lowy, Michael Montgomery
Programming .NET Security

Programming .NET Security

Adam Freeman, Allen Jones

Publisher Resources

ISBN: 9781449382476Supplemental ContentErrata Page