Does a TransactionScope that exists only to select data require a call to Complete()

Posted by fordareh on Stack Overflow See other posts from Stack Overflow or by fordareh
Published on 2010-04-29T19:30:30Z Indexed on 2010/04/29 19:37 UTC
Read the original article Hit count: 235

Filed under:
|
|

In order to select data from part of an application that isn't affected by dirty data, I create a TransactionScope that specifies a ReadUncommitted IsolationLevel as per the suggestion from Hanselman here.

My question is, do I still need to execute the oTS.Complete() call at the end of the using block even if this transaction scope was not built for the purpose of bridging object dependencies across 2 databases during an Insert, Update, or Delete?

Ex:

List<string> oStrings = null;
using (SomeDataContext oCtxt = new SomeDataContext (sConnStr))
using (TransactionScope oTS = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
{
     oStrings = oCtxt.EStrings.ToList();
     oTS.Complete();
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about linq-to-sql