Skip to Main Content
Programming WCF Services
book

Programming WCF Services

by Juval Lowy
February 2007
Intermediate to advanced content levelIntermediate to advanced
634 pages
16h 1m
English
O'Reilly Media, Inc.
Content preview from Programming WCF Services

Transactions

  1. Never use ADO.NET transactions directly.

  2. Apply TransactionFlowAttribute on the contract, not the service class.

  3. Do not perform transactional work in the service constructor.

  4. Using this book’s terminology, configure services for either Client or Client/Service transactions. Avoid None or Service transactions.

  5. Using this book’s terminology, configure callbacks for either Service or Service/Callbacks transactions. Avoid None or Callback transactions.

  6. When using the Client/Service or the Service/Callback modes, constrain the binding to flow transaction using the BindingRequirement attribute.

  7. On the client, always catch all exceptions thrown by a service configured for None or Service transactions.

  8. Strive to always configure operations to at least allow transactions:

    [ServiceContract]
    interface IMyContract
    {
       [OperationContract]
       [TransactionFlow(TransactionFlowOption.Allowed)]
       void MyMethod1(...);
    }
  9. Enable reliability and ordered delivery even when using transactions.

  10. In a service operation, never catch an exception and manually abort the transaction:

    //Avoid:
    [OperationBehavior(TransactionScopeRequired = true)]
    public void MyMethod( )
    {
       try
       {
          ...
       }
       catch
       {
          Transaction.Current.Rollback( );
       }
    }
  11. If you catch an exception in a transactional operation, always rethrow it or another exception.

  12. Always use the default isolation level of IsolationLevel.Serializable.

  13. Do not call one-way operations from within a transaction.

  14. Do not call nontransactional services from within a transaction.

  15. Do not access ...

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, 3rd Edition

Programming WCF Services, 3rd Edition

Juval Lowy
Mastering ASP.NET Web API

Mastering ASP.NET Web API

Mithun Pattankar, Malendra Hurbuns

Publisher Resources

ISBN: 0596526997Supplemental ContentErrata Page