I'm seeing alot of people at my company doing this:
var transactionOptions = new System.Transactions.TransactionOptions();
transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
{
try
{
using (DefaultContext ctx = new DefaultContext())
{
return ctx.Item.Where(x => x.State == 1);
}
}
catch (Exception err)
{
throw err;
}
finally
{
transactionScope.Complete();
}
}
Do I really need to open a transaction to a Select and call Complete() method after all ?I thought that it were just for data modification...
Some one can explain to me if it is right? Is it a good or bad pratice? Is it not necessary ?
thanks