What is the difference between:
sqlCmd = "SELECT * FROM dbo.Products WITH (NOLOCK)";
List<Product> products = thisDl.ExecuteQuery<Product>(sqlCmd).ToList();
sqlCmd = "SELECT * FROM dbo.ProductItems WITH (NOLOCK)";
List<ProductItem> productItems = thisDl.ExecuteQuery<ProductItem>(sqlCmd).ToList();
And:
using (new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
{
List<Product> products = (from p in dc.Products where select p).ToList();
List<ProductItem> productItems = (from p in dc.ProductItems where select p).ToList();
}
Of the two, which is better to use?
For your statements they are the same. Now TransactionScope is the recommended one to use and NOLOCK is said to be used as a last resort.