Search code examples
c#nhibernate

Concat 2 filtered results


I have NH query

result = Session.Query<s>()
                .Include(s => s.a)
                .Include(x => x.b)
                .Include(x => x.c);

And I have two filtered results

IQueryable<s> r1 = result.Where(x => x.c.Any(a => a.Id == "value"));
IQueryable<s> r2 = result.Where(x => x.d.Any(a => a.Id == "other"));

And I want to have

IQueryable<s> r1.Union(r2) 

or

IQueryable<s> r1.Concat(r2).Distinct()

So far everything ok, code compile and run, but in run time I got error:

The ConcatResultOperator result operator is not current supported

How to concat this two results without lose NHibernate query context. I know I can cast to list and concat lists but I want still IQueryable.


Solution

  • base on [NH-2710] Support Unions on HQL - NHibernate JIRA

    • it's not supported yet

    • you can up-vote the feature request

    enter image description here

    more :