Friday, August 19, 2011

Lambda/NHibernate

Trying to figure out Lambda/NHibernate calls today...

[TestMethod]

public void Can_Query_NHibernate_With_DateTime()

{

   var foo = Bar.GetAll().Where(o => o.MyDate > DateTime.Now).ToList();

   Assert.IsTrue(foo.Count > 0);

}

 
 

GetAll(), as given above and below, is explained here.

[TestMethod]

public void Can_Query_NHibernate_With_DateTime()

{

   var foo =

      Bar.GetAll().Where(

         p =>

         p.FirstChild.Where(

            baz =>

            baz.SecondChild.Where(

               qux => qux.MyDate > DateTime.Now

            ).Count() > 0

         ).Count() > 0);

   Assert.IsTrue(foo.Count() > 0);

}

No comments:

Post a Comment