Can we see simple WCF example of transactions using SQL Server database?
To enable WCF transaction is a 6 step procedure. So let’s create two WCF services and let’s try to call them in one transaction. Step 1 :- Create two WCF service The first step is to create two WCF service projects which will participate in one transaction. In both of these WCF services we will do database transactions and we will try to understand how a WCF transaction unifies them. We have also created a web application with name ‘WCFTransactions’ which will consume both the service in one transaction scope. Step 2:- Attribute interface methods with TransactionFlow In both the WCF service we will create a method called as ‘UpdateData’ which will do insert in to the database. So the first thing is to create the interface class with ‘ServiceContract’ attribute and the method ‘UpdateData’ with ‘OperationContract’ attribute. In order to enable transaction in ‘UpdateData’ method we need to attribute it with ‘TransactionFlow’ and we have specified that transactions are allowed for this met