Afshar
Afshar

Reputation: 11483

Is there any work-around for NHibernate-to-LINQ not supporting subqueries?

I know LINQ-to-NHibernate currently does not support sub-queries (http://ayende.com/Blog/archive/2009/07/26/nhibernate-linq-1.0-released.aspx).

Is there any workaround about it?

Upvotes: 0

Views: 2470

Answers (4)

Afshar
Afshar

Reputation: 11483

linq-to-nh DOES support sub queries in where clause. It is exact thing I needed. I was wrong with my previous answer. Both martijnboland and Stefan Steinegger were right. To see how you do sub-queries in linq-to-nh see this and this. There is also limitations.

Upvotes: 3

Afshar
Afshar

Reputation: 11483

I have used a two part LINQ query as a work around. A LINQ-to-NHibernate for not related sub query section and a LINQ-to-Object for sub query related section of the query. Please see http://afsharm.blogspot.com/2010/03/dealing-with-subqueries-in-linq-to.html for more detail.

Upvotes: 0

Stefan Steinegger
Stefan Steinegger

Reputation: 64628

I think the workaround is simply to use HQL or Criteria.

Upvotes: 1

Drevak
Drevak

Reputation: 867

I have not worked with nhibernate to linq but i'm sure that you can translate almost any subquery to a join

Upvotes: 0

Related Questions