2015-04-28 63 views
0
partial void Query1_PreprocessQuery(string Filter1, ref IQueryable<Type> query) 
{ 
    //how can I loop through the query and add data to a custom list 
} 

回答

0

一般来说,_PreprocessQuery方法是用于限定查询的内容和没有做与任何内容(这将是后处理)。因此,一个简单的方法可能是:

partial void Query1_PreprocessQuery(string Filter1, ref IQueryable<Type> query) 
{ 
    query = query.Where(x => x.FilterColumn == Filter1); 
} 

这是在服务器端,所以即使你没有拦截的结果发生,我认为这将是棘手的创建回客户端的任何名单。

将查询结果传递到客户端屏幕后,您可以循环查询并使用其中的内容,例如使用像Query1_Loaded这样的Screen Property方法或Query1_Changed之类的集合方法,具体取决于您的操作试图实现。未经测试的代码,但类似这样的:

partial void Query1_Loaded(bool succeeded) 
    { 
     // Loop through the rows on the screen ... 
     foreach (IEntityObject rowData in this.Query1) 
     { 
      // Reference individual values like this ... 
      string FilterResult = rowData.Details.Properties["FilterColumn"].Value.ToString() 
     } 
    } 
}