<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Summer of NHibernate Session 06: Querying of Child Collections is now available</title>
	<atom:link href="http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/feed/" rel="self" type="application/rss+xml" />
	<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/</link>
	<description>Miscellaneous musings on life, .NET development, and related things that don't really matter</description>
	<pubDate>Thu, 17 May 2012 21:12:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: dr dre beats</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-19/#comment-127918</link>
		<dc:creator>dr dre beats</dc:creator>
		<pubDate>Sat, 17 Mar 2012 08:05:48 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-127918</guid>
		<description>please pay attention to the articles I write.</description>
		<content:encoded><![CDATA[<p>please pay attention to the articles I write.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GreenMoose</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-15145</link>
		<dc:creator>GreenMoose</dc:creator>
		<pubDate>Fri, 15 May 2009 12:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-15145</guid>
		<description>(Uh oh the &#62; &#60; characters aren't escaped in post above..)</description>
		<content:encoded><![CDATA[<p>(Uh oh the &gt; &lt; characters aren&#8217;t escaped in post above..)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GreenMoose</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-15144</link>
		<dc:creator>GreenMoose</dc:creator>
		<pubDate>Fri, 15 May 2009 12:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-15144</guid>
		<description>Here's a little tweak to the "distinct query" via Criteria API resulting in 1 db call (instead of 2):
    public IList GetDistinctCustomersWithOrdersSince_Crit2(DateTime orderDate)
    {
      DetachedCriteria customerIds = DetachedCriteria.For(typeof (Customer))
        .SetProjection(
        Projections.Distinct(
          Projections.ProjectionList()
            .Add(Projections.Property("CustomerId"))
          )
        )
        .CreateCriteria("Orders")
        .Add(Expression.Gt("OrderDate", orderDate));

      return _Session.CreateCriteria(typeof(Customer))
        .Add(Subqueries.PropertyIn("CustomerId", customerIds))
        .List();
    }

Which resolves to SQL:
exec sp_executesql N'SELECT this_.CustomerId as CustomerId0_0_, this_.Version as Version0_0_, this_.Firstname as Firstname0_0_, this_.Lastname as Lastname0_0_ FROM Customer this_ WHERE this_.CustomerId in (SELECT distinct this_0_.CustomerId as y0_ FROM Customer this_0_ inner join [Order] order1_ on this_0_.CustomerId=order1_.Customer WHERE order1_.OrderDate &#62; @p0)',N'@p0 datetime',@p0='2008-04-01 00:00:00:000'

(found out after reading [url=http://colinramsay.co.uk/diary/2008/01/15/nhibernate-optimising-queries-with-projections/]this[/url])</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a little tweak to the &#8220;distinct query&#8221; via Criteria API resulting in 1 db call (instead of 2):<br />
    public IList GetDistinctCustomersWithOrdersSince_Crit2(DateTime orderDate)<br />
    {<br />
      DetachedCriteria customerIds = DetachedCriteria.For(typeof (Customer))<br />
        .SetProjection(<br />
        Projections.Distinct(<br />
          Projections.ProjectionList()<br />
            .Add(Projections.Property(&#8221;CustomerId&#8221;))<br />
          )<br />
        )<br />
        .CreateCriteria(&#8221;Orders&#8221;)<br />
        .Add(Expression.Gt(&#8221;OrderDate&#8221;, orderDate));</p>
<p>      return _Session.CreateCriteria(typeof(Customer))<br />
        .Add(Subqueries.PropertyIn(&#8221;CustomerId&#8221;, customerIds))<br />
        .List();<br />
    }</p>
<p>Which resolves to SQL:<br />
exec sp_executesql N&#8217;SELECT this_.CustomerId as CustomerId0_0_, this_.Version as Version0_0_, this_.Firstname as Firstname0_0_, this_.Lastname as Lastname0_0_ FROM Customer this_ WHERE this_.CustomerId in (SELECT distinct this_0_.CustomerId as y0_ FROM Customer this_0_ inner join [Order] order1_ on this_0_.CustomerId=order1_.Customer WHERE order1_.OrderDate &gt; @p0)&#8217;,N&#8217;@p0 datetime&#8217;,@p0=&#8217;2008-04-01 00:00:00:000&#8242;</p>
<p>(found out after reading [url=http://colinramsay.co.uk/diary/2008/01/15/nhibernate-optimising-queries-with-projections/]this[/url])</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David V</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-6046</link>
		<dc:creator>David V</dc:creator>
		<pubDate>Mon, 08 Dec 2008 16:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-6046</guid>
		<description>First, thanks for the great screencast series--it's very helpful!

I'm playing around with a Customes-Orders hierarchy like yours, except on a SQL CE database. My tests are similar to yours, and they pass fine when retrieving orders. But when I run a test with the debugger to get a Customer object and break, I run into a problem. When I try to manually inspect the Orders collection (as you do at 47:00 of this session), I get the following error: "Function evaluation timed out."

I'm not sure what's causing this error and it puzzles me, since my test that loads Orders runs fine. It's only when I inspect and look at orders for a different customer that I get the error.

Any thoughts on what might be causing this, and what I need to do to fix it? Thanks again.</description>
		<content:encoded><![CDATA[<p>First, thanks for the great screencast series&#8211;it&#8217;s very helpful!</p>
<p>I&#8217;m playing around with a Customes-Orders hierarchy like yours, except on a SQL CE database. My tests are similar to yours, and they pass fine when retrieving orders. But when I run a test with the debugger to get a Customer object and break, I run into a problem. When I try to manually inspect the Orders collection (as you do at 47:00 of this session), I get the following error: &#8220;Function evaluation timed out.&#8221;</p>
<p>I&#8217;m not sure what&#8217;s causing this error and it puzzles me, since my test that loads Orders runs fine. It&#8217;s only when I inspect and look at orders for a different customer that I get the error.</p>
<p>Any thoughts on what might be causing this, and what I need to do to fix it? Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alper</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-1850</link>
		<dc:creator>Alper</dc:creator>
		<pubDate>Tue, 23 Sep 2008 16:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-1850</guid>
		<description>I forgot the context. The code is my previous comment is in 

[Test]
public void CanDistinctGetCustomersWithOrdersSince()

Thanks.</description>
		<content:encoded><![CDATA[<p>I forgot the context. The code is my previous comment is in </p>
<p>[Test]<br />
public void CanDistinctGetCustomersWithOrdersSince()</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alper</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-1849</link>
		<dc:creator>Alper</dc:creator>
		<pubDate>Tue, 23 Sep 2008 16:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-1849</guid>
		<description>Hi Steve,

Great series of screen casts. I have a quick question 

I get a compile error with the following code
            foreach (var c in customers)
            {
                //TODO: Research the build error
                Assert.AreEqual(1, customers.Count(x =&#62; x == c));
            }

customers.Count(x =&#62; x == c)
"The property ...Count cannot be used with type arguments.

Any ideas?

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Steve,</p>
<p>Great series of screen casts. I have a quick question </p>
<p>I get a compile error with the following code<br />
            foreach (var c in customers)<br />
            {<br />
                //TODO: Research the build error<br />
                Assert.AreEqual(1, customers.Count(x =&gt; x == c));<br />
            }</p>
<p>customers.Count(x =&gt; x == c)<br />
&#8220;The property &#8230;Count cannot be used with type arguments.</p>
<p>Any ideas?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sbohlen</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-235</link>
		<dc:creator>sbohlen</dc:creator>
		<pubDate>Fri, 15 Aug 2008 18:39:44 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-235</guid>
		<description>@Nisar:

AFAIK, the tx.Commit() call will in fact flush the session (e.g. within an ITransaction scope, .Commit() is semantically equivalent to call ing .Flush() on the ISession instance so you are in fact correct -- there isn't a penalty for the .Flush(), but its not required either.

Good catch.</description>
		<content:encoded><![CDATA[<p>@Nisar:</p>
<p>AFAIK, the tx.Commit() call will in fact flush the session (e.g. within an ITransaction scope, .Commit() is semantically equivalent to call ing .Flush() on the ISession instance so you are in fact correct &#8212; there isn&#8217;t a penalty for the .Flush(), but its not required either.</p>
<p>Good catch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nisar Khan</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-233</link>
		<dc:creator>Nisar Khan</dc:creator>
		<pubDate>Fri, 15 Aug 2008 18:02:50 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-233</guid>
		<description>Hi Steve, 

i'm on the 6th screen cast.... you have done refactor provider class.... and wondering do we need to flush the _session ? if you are not using?

just curious about how _session working.

thanks and great videos.</description>
		<content:encoded><![CDATA[<p>Hi Steve, </p>
<p>i&#8217;m on the 6th screen cast&#8230;. you have done refactor provider class&#8230;. and wondering do we need to flush the _session ? if you are not using?</p>
<p>just curious about how _session working.</p>
<p>thanks and great videos.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sbohlen</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-211</link>
		<dc:creator>sbohlen</dc:creator>
		<pubDate>Wed, 13 Aug 2008 20:41:58 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-211</guid>
		<description>Sara:

Glad you're enjoying the content; its nice to know that my informal approach to teaching is being well-received as something other than the rest of the snoozer training videos out there on other topics :)</description>
		<content:encoded><![CDATA[<p>Sara:</p>
<p>Glad you&#8217;re enjoying the content; its nice to know that my informal approach to teaching is being well-received as something other than the rest of the snoozer training videos out there on other topics <img src='http://unhandled-exceptions.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sara</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/comment-page-1/#comment-205</link>
		<dc:creator>Sara</dc:creator>
		<pubDate>Wed, 13 Aug 2008 13:50:53 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/07/27/summer-of-nhibernate-session-06-querying-of-child-collections-is-now-available/#comment-205</guid>
		<description>I freaking love your videos, I think you're f*cking hilarious, and a refreshing change to "now you click this... see how fun that is?" 

Thank you. 


Oh yeah, and it's educational. LOL.</description>
		<content:encoded><![CDATA[<p>I freaking love your videos, I think you&#8217;re f*cking hilarious, and a refreshing change to &#8220;now you click this&#8230; see how fun that is?&#8221; </p>
<p>Thank you. </p>
<p>Oh yeah, and it&#8217;s educational. LOL.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

