locked
Rollback Transaction in WCF ? RRS feed

  • Question

  • User1954082887 posted

    I have a Registeration operation to be completed using WCF which is a 3 step process:
    1) an external service will be called to register.
    2) account id generated from above step will be saved here to Database1.
    3) ID generated in above two steps will be saved in Database2.

    I am thinking of including these into WCF transaction.
    My question is if let's say 3rd step fail then can it rollback above two steps. If no then what is the benefit of transaction here ?
    Hope I have made my question clear.

    Wednesday, April 24, 2013 5:26 AM

Answers

  • User-837620913 posted

    WCF Transactions allow the WCF component to participate in data transactions. The underlying transaction will be managed by SQL Server (if all on the same server) or Microsoft Distributed Transaction Coordinator (DTC) if database1 and database2 are on different servers.

    Since the database updates are in a transaction, if the 3rd step fails then the steps 1 and 2 will be rolled back.

    For more info, see this section on Transaction Models in the WCF documentation:  http://msdn.microsoft.com/en-us/library/ms731105.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 24, 2013 5:34 AM