CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Bad NHibernate Transaction usage

273 Views
Copy Code Show/Hide Line Numbers
public IQueryable<T> Query(Expression<Func<T, bool>> predicate)
{
    IQueryable<T> returnValue;
    using (ITransaction transaction = _session.BeginTransaction())
    {
        try
        {
            returnValue = _session.Linq<T>().Where(predicate);
            transaction.Commit();
        }
        catch (Exception ex)
        {
            transaction.Rollback();
            Log.Error(this,ex.Message,ex);
            throw;
        }
    }
    return returnValue;
}
 
by Chris Brandsma
  May 14, 2010 @ 2:09pm
Tags:
Description:
At some point transactions were added to this code. Pretty sure they are completely useless at this point.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate