1
votes

I have a wcf service which has methods which perform insert/update operations in an SQL db via stored procedures. If I enable transactions for the wcf service and call 2 methods from my client using transaction scope will the individual SQL operations also get rolled back in case of a failure.

1
If you're using Oracle it it will rollback as long as you don't call the commit method; however, you should explicitly catch exceptions and rollback so you don't lock your database up.Aelphaeis
No. I am not using oracle. I use mssql and I do have commit called within my stored procedure.ckv

1 Answers

1
votes

Enabling transactions in WCF is not enough. According to Transactions in WCF Services example you need to do the following:

  • Add transaction support to the service contract. This is required.
  • Add transaction support to the code that implements the service contract. This is required.
  • Configure transactions in the implementation code. This is optional.
  • Enable transactions on the binding. This is required.