11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 9 ■ USING TRANSACTIONS IN WCF 291ramrameshreddy.blog.com}}Console.WriteLine(" Logging Trade to database:{0}", recordText);conn.Close();}}elseConsole.WriteLine("Noting row: {0}", recordText);Next you can modify the App.config file for the service host in order to ensure that alltransactions are passed on to the QuickReturns Ltd. trade service. The console-based servicehost does not require any modifications, since the host service itself does not change. You willbe calculating the trade value and returning this to the client, as well as logging the trade intothe TradeService database. This is a simple database with a log table, which has an identityfield and the log field. Both the transactions are occurring within a transaction scope and willfail or succeed as a single unit, as shown in Listing 9-10.Listing 9-10. Modifying the Host App.config FileNow that you have established the database connectivity for the logging, you can modifythe attributes. In Listing 9-11, you will be configuring the bindings of the service touse the WS-Atomic transaction protocol.Listing 9-11. Setting the WSAtomicTransaction Binding Configuration in App.configramrameshreddyramrameshreddy

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!