From: NHibernate J. <mik...@us...> - 2006-11-20 17:49:34
|
[ http://jira.nhibernate.org/browse/NH-821?page=comments#action_14448 ] Ayende Rahien commented on NH-821: ---------------------------------- The amount of complexity this feature would bring is very high. In general, this is possible today using the List(IList) overload, and a custom IList implementation, which will call back to your code. The NH Session is currently not re-enterant, and it would take quite an effort to make it so, for little benefit. You correctly identified that proxy evaluation is going to be difficult, this is solvable by issuing the correct query to load the items that you want with projection, with no proxies involved. In general, there is little point in showing the user large amount of data, since they can't grasp it all. Paging / filtering are usually better options. > Streaming ResultSet support > --------------------------- > > Key: NH-821 > URL: http://jira.nhibernate.org/browse/NH-821 > Project: NHibernate > Type: New Feature > Components: Core > Reporter: Jerry Haltom > Priority: Trivial > > NHibernate should provide support for streaming results. A set of methods such as IQuery.List<T>(ListCb<T> cb, int pageSize) could be introduced to support this. The basic idea is that it would result in NH going to the database layer and invoking the callback periodically as it reads and hydrates instances from the underlying databaes connection. This would not be asynchronous. > The major use case for this is in populating a large list view with results as they arrive from the database, when the database supports streaming result sets. The UI could issue a query along with a callback to be invoked when data arrives. As the callback is invokved, the UI would add the data to it's display. This would result in my faster responding interfaces. > This requires a NH Session to be reentrant. Unsure if this is the case currently. The callback will receive instances which the callback may directly manipulate. If it receives an instance which is a proxy, and it attempts to access a property of it which is lazy, it would result in NH intercepting it and reentering it's own code to issue the query for the lazy properties. > No async support would be attempted. The callback would be invokved by NH directly on the thread which originally entered NH. It would be up to the programmer of the callback. > The end result of this is that the UI can start filling in results as the database works to retrieve those results, which might be the case for very long queries. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |