NH Prof: NHibernate Profiler vs. Sql Profiler
I recently got a question, asking why someone should pay for NH Prof if SQL profiler is available for (effectively) free?
The answer is actually very easy to answer. I run the following scenario through both NH Prof and SQL Profiler:
using (var s = sf.OpenSession())
using (var tx = s.BeginTransaction())
{
s.CreateCriteria<User>()
.Add(Restrictions.NaturalId()
.Set("Username", "Ayende"))
.SetCacheable(true)
.UniqueResult();
tx.Commit();
}
using (var s = sf.OpenSession())
using (var tx = s.BeginTransaction())
{
s.CreateCriteria<User>()
.Add(Restrictions.NaturalId()
.Set("Username", "Ayende"))
.SetCacheable(true)
.UniqueResult();
tx.Commit();
}
Here is what NH Prof gave me:
And here is what I got from SQL Profiler:
I think that I have rested my case, pretty conclusively.