I read so much articles about this subject and I still got some important and basic questions.
what is the purpose of transactions if it isnt use for SQL? how does it help me in wcf?
This article show an example of using simple transactions:
http://msdn.microsoft.com/en-us/library/ms172152(v=vs.90).aspx
what is the purpose of this code below if it isn’t for rolling back what ever they trying to restore in case the code fail?
void RootMethod()
{
using(TransactionScope scope = new TransactionScope())
{
/* Perform transactional work here */
SomeMethod();
scope.Complete();
}
}
void SomeMethod()
{
using(TransactionScope scope = new TransactionScope())
{
/* Perform transactional work here */
scope.Complete();
}
}
Only resources supporting transactions participate in a transaction. Usually, this is only SQL Server. Message Queueing also supports transactions.
If you don’t use any transaction-enabled resource (like normal variables…) this won’t do anything.