Skip to content

Commit

Permalink
- 补充 WithMemory null/Empty 参数判断;
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Dec 28, 2023
1 parent ebd9cbe commit 2272c46
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,11 @@ public ISelect<T1> WithSql(string sql, object parms = null)
}
public ISelect<T1> WithMemory(IEnumerable<T1> source)
{
var sb = new StringBuilder();
var list = source?.Select(a => (object)a).ToList();
if (list.Any() != true) throw new Exception(CoreStrings.Cannot_Be_NULL_Name(nameof(source)));
var sb = new StringBuilder();
(_orm.InsertOrUpdate<object>().AsType(_tables[0].Table.Type) as InsertOrUpdateProvider<object>)
.WriteSourceSelectUnionAll(source.Select(a => (object)a).ToList(), sb, _params);
.WriteSourceSelectUnionAll(list, sb, _params);

try { return WithSql(sb.ToString()); }
finally { sb.Clear(); }
Expand Down

0 comments on commit 2272c46

Please sign in to comment.