mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 01:47:06 +08:00
Update DataTableExtensions
This commit is contained in:
parent
56cce6212f
commit
b0a9e1cef1
@ -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())
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user