NHibernate Query Generator - Collection querying

time to read 2 min | 273 words

In the repository (Exists / NotExists):

   1:  [Test]
   2:  public void CanQueryOverCollections()
   3:  {
   4:      User one = User.FindOne(Where.User.Blogs.Exists(
   5:                                  Where.Blog.Name == "Ayende @ Blog"
   6:                                  ));
   7:      Assert.IsNotNull(one);
   8:  }
 
Will result in:
 
   1:  SELECT this_.Id as Id4_0_, this_.Name as Name4_0_, this_.Email as Email4_0_ 
   2:  FROM Users this_ WHERE exists (SELECT this_0_.Id as y0_ FROM Blogs 
   3:  this_0_ WHERE this_0_.Name = @p0)

 

Fluent interfaces? Take that.