62,046
社区成员
发帖
与我相关
我的任务
分享
public BuildJson(
PagerResponse<TEntity> pagerResponse,
Func<TEntity, IdType> idFunc,
params Func<TEntity, string>[] propertyFuncs)
{
this.TotalRowCount = pagerResponse.TotalRowCount;
this.ActualPageIndex = pagerResponse.ActualPageIndex;
this.TotalPageCount = pagerResponse.PageCount;
this.Rows = new List<object>();
foreach (TEntity entity in pagerResponse.Entities)
{
List<string> obj = new List<string>();
foreach (Func<TEntity, string> propertyFunc in propertyFuncs)
{
obj.Add(propertyFunc(entity));
}
this.Rows.Add(
new
{
id = idFunc(entity),
cell = obj.ToArray()
});
}
}