public DataTablesData Transform <TData, TTransform>(Func <TData, TTransform> transformRow) { var data = new DataTablesData { aaData = aaData.Cast <TData>().Select(transformRow).Cast <object>().ToArray(), iTotalDisplayRecords = iTotalDisplayRecords, iTotalRecords = iTotalRecords, sEcho = sEcho }; return(data); }
private static DataTablesData ApplyOutputRules <TSource>(DataTablesData sourceData, ResponseOptions <TSource> responseOptions) { DataTablesData outputData = sourceData; switch (responseOptions.ArrayOutputType) { case ArrayOutputType.ArrayOfObjects: // Nothing is needed break; case ArrayOutputType.BiDimensionalArray: default: outputData = sourceData.Transform <Dictionary <string, object>, object[]>(d => d.Values.ToArray()); break; } return(outputData); }