PreprocessQuery更改无效 [英] PreprocessQuery changes not working

查看:54
本文介绍了PreprocessQuery更改无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过相关实体对我的一个查询进行排序。  由于设计师不支持这一点,我的理解是我应该为我的查询挂钩PreprocessQuery事件并在那里添加order by子句。  所以我做了。

I'm trying to sort one of my queries by a related entity.  Since the designer doesn't support this, my understanding is that I'm supposed to hook the PreprocessQuery event for my query and add an order by clause there.  So I did.


 partial void FilterStations_All_PreprocessQuery(ref IQueryable<FilterStation> query)
{
  query = query.OrderBy(o => o.Broadcaster.CallLetters);
}

推荐答案


我正在尝试排序一个我的相关实体的查询。  由于设计师不支持这一点,我的理解是我应该为我的查询挂钩PreprocessQuery事件并在那里添加order by子句。  所以我做了。

I'm trying to sort one of my queries by a related entity.  Since the designer doesn't support this, my understanding is that I'm supposed to hook the PreprocessQuery event for my query and add an order by clause there.  So I did.

 


 partial void FilterStations_All_PreprocessQuery(ref IQueryable<FilterStation> query)

{

 query = query.OrderBy(o => o.Broadcaster.CallLetters);

}


这篇关于PreprocessQuery更改无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆