Every time when I need to execute more than one query at work by L2S, I’m creating explicitly a transaction using TransactionScope. Today my colleague told me that, he never creating manually a transactions, because the L2S doing it at the SubmitChanges level. I was confussing, so I have done some sample code to test it. As I far I understood th result – he was right.
My question is, was it available from the beginning of linq to sql or was this added in some .net version/service pack?
In the net, there are plenty of samples of how to use a TransactionScope with the L2S, so I’m not sure that, every one of these people could missed it?
Every time when I need to execute more than one query at work by
Share
Explicit TransactionScopes do have value if you want to wrap multiple queries and multiple calls to SaveChanges in a single Transaction…but if you are saving an object graph (which will generate multiple insert/update statements to the DB), all those statements will be wrapped in a Transaction automatically when SaveChanges is called.