[NUnit.Framework.Test] public void Test2() { NHibernate.ISession session = Z.Core.NHibernateCore.NHibernateHelper.GetCurrentSession(); var crit = session.CreateCriteria("_School"); crit.CreateCriteria("ListStudent", "_ListStudent", NHibernate.SqlCommand.JoinType.LeftOuterJoin); crit.Add(NHibernate.Criterion.Expression.Eq("__ListStudent.Name", "Abc")); var list = crit.List(); Console.Write(list.Count); }
NHibernate: SELECT * FROM Tst_School this_ left outer join Tst_Student liststud1_ on this_.Guid=liststud1_.Guid WHERE liststud1_.Name = 'Abc' How to create sql: SELECT * FROM Tst_School this_ left outer join Tst_Student liststud1_ on this_.Guid=liststud1_.Guid AND liststud1_.Name = 'Abc'
Thanks