mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
@ -541,6 +541,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
_connection = connection;
|
||||
return this as TSelect;
|
||||
}
|
||||
public TSelect WithParameters(List<DbParameter> parameters)
|
||||
{
|
||||
if (parameters != null) _params = parameters;
|
||||
return this as TSelect;
|
||||
}
|
||||
public TSelect CommandTimeout(int timeout)
|
||||
{
|
||||
_commandTimeout = timeout;
|
||||
@ -802,7 +807,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var unions = new List<Dictionary<Type, string>>();
|
||||
var trs = _tableRules.Any() ? _tableRules : new List<Func<Type, string, string>>(new[] { new Func<Type, string, string>((type, oldname) => null) });
|
||||
|
||||
if (trs.Count == 1 && _tables.Any(a => a.Table.AsTableImpl != null && string.IsNullOrWhiteSpace(trs[0](a.Table.Type, a.Table.DbName)) == true))
|
||||
if (trs.Count == 1 && _tables.Any(a => a.Table != null && a.Table.AsTableImpl != null && string.IsNullOrWhiteSpace(trs[0](a.Table.Type, a.Table.DbName)) == true))
|
||||
{
|
||||
string[] LocalGetTableNames(SelectTableInfo tb)
|
||||
{
|
||||
@ -1196,6 +1201,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_orm.CodeFirst.IsAutoSyncStructure)
|
||||
(_orm.CodeFirst as CodeFirstProvider)._dicSycedTryAdd(typeof(TDto)); //._dicSyced.TryAdd(typeof(TReturn), true);
|
||||
var ret = (_orm as BaseDbProvider).CreateSelectProvider<TDto>(null) as Select1Provider<TDto>;
|
||||
ret._commandTimeout = _commandTimeout;
|
||||
ret._connection = _connection;
|
||||
ret._transaction = _transaction;
|
||||
ret._whereGlobalFilter = new List<GlobalFilter.Item>(_whereGlobalFilter.ToArray());
|
||||
ret._cancel = _cancel;
|
||||
ret._params.AddRange(_params);
|
||||
if (ret._tables[0].Table == null) ret._tables[0].Table = TableInfo.GetDefaultTable(typeof(TDto));
|
||||
var parser = new WithTempQueryParser(this, null, selector, ret._tables[0]);
|
||||
|
@ -172,6 +172,22 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (retsp._tableRules.Count == 0) ret.WithSql(null, $" \r\n{sql2}");
|
||||
return ret;
|
||||
}
|
||||
public ISelect<T1> UnionAll(ISelect<T1> select2)
|
||||
{
|
||||
var sql1 = this.ToSql();
|
||||
var sql2 = select2.ToSql();
|
||||
var ret = (_orm as BaseDbProvider).CreateSelectProvider<T1>(null) as Select1Provider<T1>;
|
||||
ret.WithSql($"{sql1} \r\nUNION ALL \r\n{sql2}");
|
||||
ret._commandTimeout = _commandTimeout;
|
||||
ret._connection = _connection;
|
||||
ret._transaction = _transaction;
|
||||
ret._whereGlobalFilter = new List<GlobalFilter.Item>(_whereGlobalFilter.ToArray());
|
||||
ret._cancel = _cancel;
|
||||
ret._diymemexpWithTempQuery = _diymemexpWithTempQuery;
|
||||
ret._tables[0] = _tables[0];
|
||||
ret._params = _params;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ISelectGrouping<TKey, T1> GroupBy<TKey>(Expression<Func<T1, TKey>> columns)
|
||||
{
|
||||
|
@ -234,6 +234,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_orm.CodeFirst.IsAutoSyncStructure)
|
||||
(_orm.CodeFirst as CodeFirstProvider)._dicSycedTryAdd(typeof(TDto)); //._dicSyced.TryAdd(typeof(TReturn), true);
|
||||
var ret = (_orm as BaseDbProvider).CreateSelectProvider<TDto>(null) as Select1Provider<TDto>;
|
||||
ret._commandTimeout = _select._commandTimeout;
|
||||
ret._connection = _select._connection;
|
||||
ret._transaction = _select._transaction;
|
||||
ret._whereGlobalFilter = new List<GlobalFilter.Item>(_select._whereGlobalFilter.ToArray());
|
||||
ret._cancel = _select._cancel;
|
||||
if (ret._tables[0].Table == null) ret._tables[0].Table = TableInfo.GetDefaultTable(typeof(TDto));
|
||||
var parser = new Select0Provider.WithTempQueryParser(_select, this, selector, ret._tables[0]);
|
||||
var sql = $"\r\n{this.ToSql(parser._insideSelectList[0].InsideField)}";
|
||||
|
Reference in New Issue
Block a user