title: NHibernate entity projection
body: <p>I'm using NHibernate with QueryOver API to query my domain entities. The problem is getting duplicate results. For example when querying following domain:
  <img src="https://i.stack.imgur.com/l1IGf.png" alt="domain"></p>
  
  <p>I use code like:</p>
  
  <pre><code>  var list = Session.QueryOver&lt;Post&gt;()
                      .JoinQueryOver&lt;Comment&gt;(x =&gt; x.Comments)
                      .Where(c =&gt; c.Name == "Name")
                      .Take(5)
                      .List();
  </code></pre>
  
  <p>Generated SQL will be like following:</p>
  
  <pre><code>SELECT Top(5) * FROM Posts p left outer join Comments c on p.Id = c.PostId
  </code></pre>
  
  <p>The problem here is that after left join is done resulting record set has more then 5 rows. And then <code>TOP</code> function applies and cuts results. So for example if first post has 5 comments, I will get this post 5 times and won't get others. </p>
  
  <p>I know why it happens and found a nice <a href="http://nhforge.org/wikis/howtonh/get-unique-results-from-joined-queries.aspx" rel="nofollow noreferrer">post</a> about it. 
  But Is there a projection that will tell nhibernate to select only columns from the <code>Post</code> entity and not add columns from <code>Comment</code> entity in select? Maybe some other method (not JoinQueryOver) should be used?</p>