Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 7. Transactions > Instance Management and Transactions

7.9. Instance Management and Transactions

Because the service instance goes through the trouble of retrieving its state and saving it on every method call, why wait till the end of the transaction to destroy the object? A per-call service would therefore be the most natural programming model for a transactional WCF service. In addition, the behavioral requirements for a state-aware transactional object and the requirements of a per-call object are the same—both retrieve and save their state at the method boundaries (compare Example 4-3 with Example 7-15). In spite of the fact that the per-call instancing mode is the most congenial for transactions, WCF does support a per-session and even a singleton service, albeit with a considerably more complex programming model.

7.9.1. Per-Call Transactional Service

A far as a per-call service call is concerned, transactional programming is almost incidental. Every call on the service gets a new instance, and that call may or may not be in the same transaction as the previous call (see Figure 7-8).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial