NHibernate Lazy=“Extra”?

For version 2. X it is only used to translate a collection.Count() into a select count and as far as I can see in the source, it will also allow the construct collection5 to fetch that particular entity (with index 5) instead of hydrating the whole collection.

For version 2. X it is only used to translate a collection.Count() into a select count and as far as I can see in the source, it will also allow the construct collection5 to fetch that particular entity (with index 5) instead of hydrating the whole collection. For version 3.

X I didn't see anything related in the release notes.

Wow - thanks for checking the source code for me (!). Is this documented anywhere, for my own future reference? – Adam Rackis Feb 22 at 15:58 Consider the nhibernate reference as a whitelist (but always read the release notes too, see below): While various other undocumented stuff may work, only what is explicitly named in the reference is a supported feature.So, when the reference says that the extra laziness is for efficient individual element fetching in collections, that's what you should expect.

Check 17.1. Fetching strategies.It mentions the individual fetch but not the count 'hack'. However, the release notes include it. Personally I don't use it, its buggy in my scenarios and I prefer the ISession.CreateFilter() mechanism – Jaguar Feb 22 at 16:15 Cool - thanks again!

– Adam Rackis Feb 22 at 19:44.

The lazy = extra allow to count the element of a collection without needing of fetching it, since the lazy entity is decorated with a proxy, when the client code ask for the . Count on the collection, a proper "select count" query is issued to the database. Without lazy=extra the collection is read from the database.

Thank you for your answer. I'm aware of the behavior you mentioned. I'm looking for some sort of documentation showing some of the more robust cases it's capable of (if any) - like handling an Any() call and turning it into an EXISTS query.

– Adam Rackis Feb 22 at 15:26 Sorry for mistooking your question. But afaik the behaviour you described does not apply. Maybe the nh linq provider is capable of.

– Felice Pollano Feb 22 at 15:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions