Update DataTableExtensions

This commit is contained in:
sunkaixuan 2022-11-14 13:39:09 +08:00
parent 56cce6212f
commit b0a9e1cef1
2 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ namespace SqlSugar
var columns = source.Select(columnSelector).Distinct();
foreach (var column in columns)
table.Columns.Add(new DataColumn(column.ToString()));
table.Columns.Add(new DataColumn(column?.ToString()));
var rows = source.GroupBy(rowSelector.Compile())
.Select(rowGroup => new
@ -89,7 +89,7 @@ namespace SqlSugar
rowName = "Group_"+string.Join("_", ((NewExpression)rowSelector.Body).Arguments.Select(it => it as MemberExpression).Select(it => it.Member.Name));
var columns = source.Select(columnSelector).Distinct();
cols = (new[] { rowName }).Concat(columns.Select(x => x.ToString())).ToList();
cols = (new[] { rowName }).Concat(columns.Select(x => x?.ToString())).ToList();
var rows = source.GroupBy(rowSelector.Compile())

View File

@ -28,7 +28,7 @@ namespace SqlSugar
var columns = source.Select(columnSelector).Distinct();
foreach (var column in columns)
table.Columns.Add(new DataColumn(column.ToString()));
table.Columns.Add(new DataColumn(column?.ToString()));
var rows = source.GroupBy(rowSelector.Compile())
.Select(rowGroup => new
@ -89,7 +89,7 @@ namespace SqlSugar
rowName = "Group_"+string.Join("_", ((NewExpression)rowSelector.Body).Arguments.Select(it => it as MemberExpression).Select(it => it.Member.Name));
var columns = source.Select(columnSelector).Distinct();
cols = (new[] { rowName }).Concat(columns.Select(x => x.ToString())).ToList();
cols = (new[] { rowName }).Concat(columns.Select(x => x?.ToString())).ToList();
var rows = source.GroupBy(rowSelector.Compile())