﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>Thilo,
  
There are several factors at play here.
  
a) you may be using an ADO.Net provider that will only push results to NHibernate after a significant amount has been reached.
  
b) you may be using a buffered output.
  
  
The value of streaming is reducing the time to first byte, and you need to ensure that you deal with this in both ends.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment22</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment22</guid><pubDate>Mon, 16 Aug 2010 15:31:08 GMT</pubDate></item><item><title>Thilo R commented on NHibernate: Streaming large result sets</title><description>I tried this approach while streaming a few MBs over UMTS - it takes over 55 seconds. Unfortunately no performance impact was measureable. It seems that the streaming starts as soon as all the data was loaded from the database. Is there something I am missing or is this method not working when streaming from the database directly row by row (like the DataReader)?
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment21</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment21</guid><pubDate>Mon, 16 Aug 2010 14:48:10 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description> Bahador ,
  
No
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment20</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment20</guid><pubDate>Fri, 23 Jul 2010 07:18:35 GMT</pubDate></item><item><title>Bahador Nooraei B. commented on NHibernate: Streaming large result sets</title><description>Is there a nice way to terminate data fetching when we use this approach?
  
  
I mean, say, we need 100 objects that meet a criteria that can only be enforced in-memory.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment19</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment19</guid><pubDate>Thu, 22 Jul 2010 19:14:53 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>&gt;  the behavior is the same
  
  
Not really, no.
  
Sure, on the surface it looks like that is all it is doing, but they produce quite a different behavior.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment18</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment18</guid><pubDate>Thu, 22 Jul 2010 16:58:41 GMT</pubDate></item><item><title>Frank commented on NHibernate: Streaming large result sets</title><description>I guess the folks who did the NHibernate.Linq thought otherwise. Whether or not you're reading data from ISession or IStatelessSession, the behavior is the same, it's just one does not do any tracking and the when the foundation is not designed properly, we start seeing things like Linq not working on IStatelessSession. I guess we can agree to disagree but I thank you for your input.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment17</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment17</guid><pubDate>Thu, 22 Jul 2010 15:57:33 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>@Frank,
  
The problem is that there really aren't is-a between stateless and regular session.
  
They serve different purposes.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment16</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment16</guid><pubDate>Thu, 22 Jul 2010 07:08:26 GMT</pubDate></item><item><title>Frank commented on NHibernate: Streaming large result sets</title><description>So what are your suggestions or pointers? To me, it doesn't make sense to have IStatelessSession and ISession not inherit from some other common interface and I believe there's already a suggested patch (NH-2211) which doesn't look like it made it into the trunk (3.0). 
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment15</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment15</guid><pubDate>Wed, 21 Jul 2010 16:27:10 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>@Frank,
  
Probably, but I don't really like that attempt anyway
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment14</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment14</guid><pubDate>Tue, 20 Jul 2010 11:10:20 GMT</pubDate></item><item><title>Frank commented on NHibernate: Streaming large result sets</title><description>Doesn't this break NHibernate.Linq which only work under ISession and In essence breaks people's generic repository pattern?
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment13</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment13</guid><pubDate>Mon, 19 Jul 2010 04:01:55 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>Yes
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment12</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment12</guid><pubDate>Wed, 07 Jul 2010 13:34:05 GMT</pubDate></item><item><title>Nabil commented on NHibernate: Streaming large result sets</title><description>Does this work with Crtieria API?
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment11</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment11</guid><pubDate>Wed, 07 Jul 2010 10:22:57 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate: Streaming large result sets</title><description>Ajai,
  
The use of NDataReader depends on the exact mix of what you are doing, the driver that you use and the configuration option.
  
Yes, if it is wrapped, it isn't good, but it is controllable.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment10</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment10</guid><pubDate>Wed, 30 Jun 2010 06:36:53 GMT</pubDate></item><item><title>Hendry Luk commented on NHibernate: Streaming large result sets</title><description>Not to mention that if we use Rx (instead of reinventing another ActionableList), we'll also get all the nice works those guys have been working hard on at Redmond, e.g. Linq support, parallelism. Hence..
  
  
// not only caters for simplest use-cases
  
IObservable books = s.CreateQuery("from Book")
  
    .Stream(); //Extension method?
  
books.Subscribe(book=&gt; Console.Writeline(book.Name));
  
  
// but also fancy stuff
  
IObservable customers = s.CreateQuery("from Customer").Stream();
  
var mayLike = from book in books 
  
    join cus in customers on book.Genre == cus.FavouriteGenre
  
    select new {Book = book, Customer = cus};
  
mayLike.Subscribe(x=&gt; 
  
    Console.WriteLine("Customer {0} may like {1}", 
  
        x.Book.Title, x.Customer.FullName)};
  
  
Maybe a bad example, but thats beside the point.
  
I thought it's a really neat abstraction for a "push-model queryable cursor" :)
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment9</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment9</guid><pubDate>Wed, 30 Jun 2010 03:38:30 GMT</pubDate></item><item><title>Hendry Luk commented on NHibernate: Streaming large result sets</title><description>This is precisely what Rx is for. When you created that ActionableList, you actually just reinvented a push-model (akin to IObservable in Rx). I for one would be interested to see Rx (and other .net features) getting built into NH that would enrich it from its java ancestry
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment8</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment8</guid><pubDate>Wed, 30 Jun 2010 02:21:43 GMT</pubDate></item><item><title>Ajai Shankar commented on NHibernate: Streaming large result sets</title><description>Hi Ayende
  
  
Is that really true?
  
  
I remember quite some while back I wanted to stream results and posting to nhusers made it seem that was not the case:
  
  
[groups.google.com/.../d9423d9a45ff9c62](http://groups.google.com/group/nhusers/browse_thread/thread/d6da011ed639cb5b/d9423d9a45ff9c62)  
  
One of the findings in that thread was:
  
  
The SqlDataReader is wrapped in a Driver.NDataReader which loads
  
everything into an internal list!
  
  
Maybe like you said all that was missing is the correct extension point?
  
  
Ajai
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment7</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment7</guid><pubDate>Tue, 29 Jun 2010 22:23:11 GMT</pubDate></item><item><title>NC commented on NHibernate: Streaming large result sets</title><description>Wheres NH3! Heard no news about NH in ages.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment6</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment6</guid><pubDate>Tue, 29 Jun 2010 21:33:18 GMT</pubDate></item><item><title>Alexey Romanov commented on NHibernate: Streaming large result sets</title><description>On one hand I want to say: "That violates semantics of IList completely!" On the other, I don't see a better solution.
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment5</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment5</guid><pubDate>Tue, 29 Jun 2010 20:12:25 GMT</pubDate></item><item><title>Steve Py commented on NHibernate: Streaming large result sets</title><description>Effectively an NHibernate-friendly cursor.
  
  
I nice demonstration of consuming large amounts of data responsively without allocating the memory to store the entire result set.
  
  
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment4</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment4</guid><pubDate>Mon, 28 Jun 2010 22:20:12 GMT</pubDate></item><item><title>robsosno commented on NHibernate: Streaming large result sets</title><description>Partial solution would be also to use Enumerable (if books table is not extra large):
  
using (ISession s = OpenSession())
  
{
  
    var books = s.Enumerable("from Book")
  
        .List
&lt;book();
  
  
    foreach (var book in books)
  
    {
  
        Console.WriteLine(book.Name);
  
    }
  
}
  
However there is performance penalty: 
  
 - (select Id from Book )  *  1
  
 - (select * from Book Where Id = :id)   * number of records
  
  
Ideally I would like to see in NHibernate Iterable interface which would work like this:
  
using (ISession s = OpenSession())
  
{
  
    var books = s.Iterable("from Book")
  
        .List
&lt;book(); // DB not touched; books contains only proxy
  
  
    foreach (var book in books) // fetch from collection actually from Db
  
    {
  
        Console.WriteLine(book.Name);
  
    }
  
}
  
I don't know if this is technically possible. I know that for my particular needs it would be very convenient - calculating complex fees for each account periodically. Currently we are using stored procedures for things like this.
&gt;</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment3</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment3</guid><pubDate>Mon, 28 Jun 2010 20:07:37 GMT</pubDate></item><item><title>gs commented on NHibernate: Streaming large result sets</title><description>__For reporting scenarios, there are better alternatives, usually (and before you ask, any reporting package will do. Right tool for the job, etc).
  
  
I'll bite, what's everyone use? I've been using Quartz.Net to run heavy reporting jobs at night and as sort of a load balancer (so really I use NHibernate, as Quartz.net just triggers the report). I wasn't aware of any report specific tools. Of course searching ".NET Reporting" brings up a bunch of garbage ...
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment2</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment2</guid><pubDate>Mon, 28 Jun 2010 19:40:00 GMT</pubDate></item><item><title>orip commented on NHibernate: Streaming large result sets</title><description>awesome - I guess you could also create a list that creates an IEnumerator that supplies the results one by one. Would the effect be similar?
  
  
	var books = new IterableList
&lt;book	();
  
	s.CreateQuery("from Book").List(books);
  
	foreach (var book in books)
  
	  Console.WriteLine(book.Name);
&gt;  
</description><link>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment1</link><guid>http://ayende.com/4548/nhibernate-streaming-large-result-sets#comment1</guid><pubDate>Sun, 27 Jun 2010 10:22:05 GMT</pubDate></item></channel></rss>