I've spent the last few days with System.Transactions. I've been covering this feature set in a number of talks in the last few months and I can only repeat: every time I work with it, I'm blown away by the beauty of how Transaction and TransactionScope work seamlessly with current technology.
Whenever a new transaction model is introduced, the main roadblock it faces is non-interoperability with existing code. I think that this is one of the reasons (apart from the obvious DTC configuration) why COM+ transactions took so long to take off. Now ... if you have performed the switch to COM+ or Enterprise Services in the past, the great news is that it will work quite nicely together with System.Tx.
And I still think that the following is absolute beauty. It just works.
using (TransactionScope sc = new TransactionScope()) { // ... use some ADO.NET without explicit transactions // ... use a COM+ component or an Enterprise Service (which, then again, is the same thing anyway) // ... send some messages to a Queue with MessageQueueTransactionOption.Automatic sc.Complete(); }
And, of course, if you only ever access a single SQL Server 2005 as your resource manager, there won't even be a DTC involved. Beauty.
Update: Now I only need to figure out how I can send a transactional message when not using TransactionScope, but an explicitly created Transaction. And no, I don't think setting Transaction.Current before sending the message is a sound way of accomplishing this ;-)