Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to prevent boolean performance problems with NHibernate LINQ provider
    text
    copied!<p>We were using NHibernate 2.1 and I upgraded our system to 3.0 to test the new LINQ provider. I compared the linq provider, createquery, and queryover.</p> <p>Createquery and queryover did pretty much the same thing, same performance. However the LINQ provider did some REALLY funky stuff!</p> <pre><code> var items = (from m in NHibernateSession.Current.Query&lt;Listing&gt;() where m.Active == true select m).Take(10).ToList(); var items2 = NHibernateSession.Current.CreateQuery("from Listing where Active = :val").SetBoolean("val", true).SetMaxResults(10).List(); var items3 = NHibernateSession.Current.QueryOver&lt;Listing&gt;() .Where(m =&gt; m.Active == true) .Take(10).List(); </code></pre> <p>Sql from createquery &amp; queryover:</p> <pre><code>select TOP ( 10 /* @p0 */ ) listing0_.PackageID as PackageID13_, listing0_.MatchComplete as MatchCom2_13_, listing0_.ExpirationDate as Expirati3_13_, listing0_.Active as Active13_, listing0_.Archived as Archived13_, listing0_.Deleted as Deleted13_, listing0_.UserID as UserID13_ from Marketplace.Listings listing0_ where listing0_.Active = 1 /* @p1 */ </code></pre> <p>Query from LINQ:</p> <pre><code>select TOP ( 10 /* @p0 */ ) listing0_.PackageID as PackageID13_, listing0_.MatchComplete as MatchCom2_13_, listing0_.ExpirationDate as Expirati3_13_, listing0_.Active as Active13_, listing0_.Archived as Archived13_, listing0_.Deleted as Deleted13_, listing0_.UserID as UserID13_ from Marketplace.Listings listing0_ where case when listing0_.Active = 1 then 'true' else 'false' end = case when 'True' /* @p1 */ = 'true' then 'true' else 'false' end </code></pre> <p>The duration from NH Profiler for LINQ is 37/91 compared to 2/2</p> <p>Is this supposed to be happening? Or am I missing a configuration setting for telling LINQ to convert Boolean comparisons to bit?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload