Castle.ActiveRecord 子表查询、排序
//Order.Product.Category (1-1-1)
DetachedCriteria cri = DetachedCriteria.For(typeof(OrderInfo), "Order")
.CreateAlias("Product", "Product")
.CreateAlias("Product.Category", "Category")
.Add(Expression.Like("Category.Name", "a", MatchMode.Anywhere))
.AddOrder(Order.Desc("Category.CreatedTime"));
DetachedCriteria cri = DetachedCriteria.For(typeof(OrderInfo), "Order")
.CreateAlias("Product", "Product")
.CreateAlias("Product.Category", "Category")
.Add(Expression.Like("Category.Name", "a", MatchMode.Anywhere))
.AddOrder(Order.Desc("Category.CreatedTime"));
关键在于别名的写法。
看来NHibernate方面的东西还是不得不学。