mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-20 17:52:51 +08:00
- 补充 WithMemory null/Empty 参数判断;
This commit is contained in:
parent
ebd9cbed0f
commit
2272c46df6
@ -525,9 +525,11 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
}
|
}
|
||||||
public ISelect<T1> WithMemory(IEnumerable<T1> source)
|
public ISelect<T1> WithMemory(IEnumerable<T1> source)
|
||||||
{
|
{
|
||||||
|
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();
|
var sb = new StringBuilder();
|
||||||
(_orm.InsertOrUpdate<object>().AsType(_tables[0].Table.Type) as InsertOrUpdateProvider<object>)
|
(_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()); }
|
try { return WithSql(sb.ToString()); }
|
||||||
finally { sb.Clear(); }
|
finally { sb.Clear(); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user