示例#1
0
        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);
        }
示例#2
0
        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);
        }