Code it Yourself…

A blog on Microsoft Azure and .NET by Carlos Mendible

NHibernate.Linq Issue when a query is executed having the same alias but with different associations paths

When running a query like the following:

var query = nhib-Arms.Where(a => a.LeftHand.Thumb.Length == 1 || a.RightHand.Thumb.Length == 1);

Thumb alias was always taken as part of the a.LeftHand association path, therefore leading to wrong results.

I’ve worked on patch and test to fix this issue, so Thumb alias is once part of the a.LeftHand association path and once as part of the a.RightHand association path.

You can find a patch file for this issue here:

Or you can also download pruiz’s already patched version of nhiberante-contribut project here:

Hope it helps!!!