NHibernate Criteria.AddOrder(Order.Asc("Column.Property"))
I have an OrderEntity that has a property OrderStatistics that has a property CreateDate. It looks like Order.OrderStatistics.CreateDate.
I will like to fetch all orders and sort them by CreateDate.
fetchQuery.UnderlyingCriteria.AddOrder(Order.Asc(开发者_运维百科"OrderStatistics.CreateDate")) does not wokr
fetchQuery.UnderlyingCriteria.AddOrder(Order.Asc("CreatorName")) works
How can I make 1 work ?
Thank you,
fetchQuery
.UnderlyingCriteria
.CreateAlias("OrderStatistics", "stats")
.AddOrder(Order.Asc("stats.CreateDate"))
Or
OrderStatistic stats = null;
fetchQuery
.CreateAlias(order => order.OrderStatistics, () => stats)
.OrderBy(() => stats.CreateDate);
精彩评论