Doubts about ProcessContains and CollectionContainsGenerator

Skip to first unread message

Ramiro Rivera

Jul 26, 2020, 2:41:03 PM7/26/20
to nhibernate-development
Hello everyone.

I'm debugging some simple nhibernate unit tests in order to get a better idea of how the HqlTree and Linq Generators work.

My test is something like this:

IEnumerable<string> valuesToCheck = new[] { "nhibernate", "core", "ayende" }.ToList();
var myQuery = db.Orders
.SelectMany(x => x.OrderLines)
.Where(x => valuesToCheck.Contains(x.Id.ToString()));

var query = myQuery.ToList();

I was expecting to see the BuildHql of the CollectionContainsGenerator get executed, however the ProcessContains is executed instead. I'm trying to customize the generated sql for a Contains call, and I don't exactly understand why the Contains generator is not getting called.

Do I have to call the Contains method in some special way in order to get the generator called?

Thanks in advanced!
Reply all
Reply to author
0 new messages