Reputation: 17408
Is it possible to get something like this:
return Session.Query<A>().Where(x => x is B).ToList();
where B derives from A working for an interface (i.e. get all objects that implement certain interface)? Thanks.
Upvotes: 2
Views: 3515
Reputation: 5666
You can't directly convert this statement to SQL. First you will have to evaluate the query or use AsEnumerable()
.
return Session.Query<A>().AsEnumerable().Where(x => x is B).ToList();
Or:
return Session.Query<A>().AsEnumerable().OfType<B>().ToList();
The part after the AsEnumerable
will be executed in memory.
Upvotes: 1