Ayende @ Rahien

Refunds available at head office

Future Query Of implemented

It took very little time to actually make this work. I knew there was a reason liked my stack, it is flexible and easy to work with.

You can check the implementation here, it is about 100 lines of code.

And the test for it:

FutureQueryOf<Parent> futureQueryOfParents = new FutureQueryOf<Parent>(DetachedCriteria.For<Parent>());
FutureQueryOf<Child> futureQueryOfChildren = new FutureQueryOf<Child>(DetachedCriteria.For<Child>());
Assert.AreEqual(0, futureQueryOfParents.Results.Count);

//This also kills the database, because we use an in
// memory one ,so we ensure that the code is not 
// executing a second query
CurrentContext.DisposeUnitOfWork();

Assert.AreEqual(0,  futureQueryOfChildren.Results.Count);

Comments

Jonathan Leibiusky
01/24/2008 04:09 PM by
Jonathan Leibiusky

I might be wrong, but this seems to be something that NHibernate should contemplate because it's intended to optimize database access by batching the queries.

What do you think?

Ayende Rahien
01/24/2008 04:25 PM by
Ayende Rahien

Yes, I agree, please raise it in the list.

Comments have been closed on this topic.