mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-05 16:00:52 +08:00
- 忧化 GroupBySelf + ToList<Dto> 不自动映射;
This commit is contained in:
@@ -49,6 +49,8 @@ namespace FreeSql.Internal.CommonProvider
|
||||
public bool _is_AsTreeCte;
|
||||
public BaseDiyMemberExpression _diymemexpWithTempQuery;
|
||||
public Func<DbTransaction> _resolveHookTransaction;
|
||||
public bool _groupBySelfFlag = false;
|
||||
public bool _isIncluded = false;
|
||||
|
||||
public bool IsDefaultSqlContent => _tables.Count == 1 && _tables[0].Table?.AsTableImpl == null &&
|
||||
_distinct == false && _is_AsTreeCte == false && _where.Length == 0 && _join.Length == 0 &&
|
||||
@@ -157,6 +159,9 @@ namespace FreeSql.Internal.CommonProvider
|
||||
to._cancel = from._cancel;
|
||||
to._is_AsTreeCte = from._is_AsTreeCte;
|
||||
to._diymemexpWithTempQuery = from._diymemexpWithTempQuery;
|
||||
to._resolveHookTransaction = from._resolveHookTransaction;
|
||||
to._groupBySelfFlag = from._groupBySelfFlag;
|
||||
to._isIncluded = from._isIncluded;
|
||||
}
|
||||
|
||||
internal class WithTempQueryParser : BaseDiyMemberExpression
|
||||
|
||||
@@ -851,7 +851,6 @@ namespace FreeSql.Internal.CommonProvider
|
||||
this.GroupBy(sql.Length > 0 ? sql.Substring(2) : null);
|
||||
return new SelectGroupingProvider<TKey, TValue>(_orm, this, map, sql, _commonExpression, _tables);
|
||||
}
|
||||
bool _groupBySelfFlag = false;
|
||||
public TSelect InternalGroupBySelf(Expression column)
|
||||
{
|
||||
_groupBySelfFlag = true;
|
||||
@@ -913,7 +912,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var index = 0;
|
||||
var findSubSelectMany = new List<Expression>();
|
||||
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, map, ref index, select, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, findSubSelectMany, true);
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, map, ref index, select, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, findSubSelectMany, _groupBySelfFlag == false);
|
||||
var af = new ReadAnonymousTypeAfInfo(map, field.Length > 0 ? field.Remove(0, 2).ToString() : null);
|
||||
if (findSubSelectMany.Any() == false) return this.ToListMapReaderPrivate<TReturn>(af, new ReadAnonymousTypeOtherInfo[0]);
|
||||
|
||||
@@ -930,7 +929,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
var otherMap = new ReadAnonymousTypeInfo();
|
||||
field.Clear();
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, otherMap, ref index, find.Item1, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, null, true);
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, otherMap, ref index, find.Item1, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, null, _groupBySelfFlag == false);
|
||||
var otherRet = new List<object>();
|
||||
var otherAf = new ReadAnonymousTypeOtherInfo(field.ToString(), otherMap, otherRet);
|
||||
afs.Add(NativeTuple.Create(find.Item1, find.Item2, otherAf));
|
||||
@@ -1554,7 +1553,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var index = 0;
|
||||
var findSubSelectMany = new List<Expression>();
|
||||
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, map, ref index, select, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, findSubSelectMany, true);
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, map, ref index, select, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, findSubSelectMany, _groupBySelfFlag == false);
|
||||
var af = new ReadAnonymousTypeAfInfo(map, field.Length > 0 ? field.Remove(0, 2).ToString() : null);
|
||||
if (findSubSelectMany.Any() == false) return await this.ToListMapReaderPrivateAsync<TReturn>(af, new ReadAnonymousTypeOtherInfo[0], cancellationToken);
|
||||
|
||||
@@ -1571,7 +1570,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
var otherMap = new ReadAnonymousTypeInfo();
|
||||
field.Clear();
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, otherMap, ref index, find.Item1, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, null, true);
|
||||
_commonExpression.ReadAnonymousField(_tables, _tableRule, field, otherMap, ref index, find.Item1, this, _diymemexpWithTempQuery, _whereGlobalFilter, null, null, _groupBySelfFlag == false);
|
||||
var otherRet = new List<object>();
|
||||
var otherAf = new ReadAnonymousTypeOtherInfo(field.ToString(), otherMap, otherRet);
|
||||
afs.Add(NativeTuple.Create(find.Item1, find.Item2, otherAf));
|
||||
|
||||
@@ -763,7 +763,6 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
}
|
||||
|
||||
bool _isIncluded = false;
|
||||
public ISelect<T1> IncludeIf<TNavigate>(bool condition, Expression<Func<T1, TNavigate>> navigateSelector) where TNavigate : class => condition ? Include(navigateSelector) : this;
|
||||
public ISelect<T1> Include<TNavigate>(Expression<Func<T1, TNavigate>> navigateSelector) where TNavigate : class
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user