WCF transactions -
i imagine following wcf service usage: (of cash acceptor)
service consumer 1 service consumer 2 cashacceptorservice.begintransaction(); cashacceptorservice.stopdevice(); //this should throw exception: device locked / used in transaction cashacceptorservice.acceptmoney(); cashacceptorservice.endtransaction();
service consumer 1 , 2 use same wcf single instance. wonder if functionality implemented. wcf transactions offer this?
how see done?
if following true:
- the service interacting transactional object (eg database)
- the service has transaction flow enabled
then wcf indeed offer this.
the client can use transactionscope class. transactions initiated on client flow through service automatically.
using(transactionscope transactionscope = new transactionscope()) { // stuff service here cashacceptorservice.acceptmoney(); // // transactionscope.complete(); }
handling transactions in wcf tends entire chapter of book, should enough information on right track.
Comments
Post a Comment