我有一个按代码对多的包映射,我想按desc顺序按两列(当前列和目标列)进行排序,但是IBagPropertiesMapper没有OrderByDescending()和ThenByDescending()方法。仅void OrderBy<TProperty>(Expression<Func<TElement, TProperty>> property
和void OrderBy(string sqlOrderByClause)
。我也不知道如何使用字符串sqlOrderByClause。
班级
public class Application{
public virtual int Id { get; set; }
public virtual IList<Record> Records { get; set; }
}
public class Record{
public virtual Application Application { get; set; }
public virtual bool Current { get; set; }
public virtual DateTime? From { get; set; }
public virtual DateTime? To { get; set; }
}
public ApplicationMap(){
Bag(x => x.Records,
cm => {
cm.Inverse(true);
cm.Key(km => km.Column("ApplicationId"));
cm.OrderBy();
}