Retrieving object and child collection in NHibernate using Linq?

It seems that this feature has a bug: stackoverflow.com/questions/880061/first... Take a look at the generated database query, if it has TOP 1 clause, this can be the problem Remember that Linq to Nbernate is still far from production ready, so this kind of bugs can occur.

It seems that this feature has a bug: stackoverflow.com/questions/880061/first... Take a look at the generated database query, if it has TOP 1 clause, this can be the problem. Remember that Linq to Nbernate is still far from production ready, so this kind of bugs can occur.

1 Thanks, I thought this may have been a bug, but wanted to check that I was using the correct Linq method. Using NHProf I can see that the query has a limit 1 clause (sqlite equivalent of top 1). I have changed my code to be: return order.ToList()0; and this works as expected.Thanks.

– Simon May 24 '09 at 13:48.

I have a problem using Linq to NHibernate to load an object and eagerly load a child collection. I am trying to load an Order with a specific ID and (eagerly) all of it's child OrderLines using Linq. However, when I display the order, the OrderLines property only contains one object - the database definitely has 3.

Bizarrely, if I do a foreach around order before the return I do get all 3 child items - but this hits the database twice. I have tried modifying the query to use Single() instead, but that doesn't work either. Am I doing something wrong with linq?

Or is my use of Expand incorrect? Note: I am using FluentNHibernate Automapping to create my NH Mapping, and my database is a Sqlite database (a file, not in memory).

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


Thank You!
send