mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 优化 .Select<object>().WithSql(sql).ToList<T>() 体验;
This commit is contained in:
parent
ad83e0c26a
commit
0de393169d
@ -577,6 +577,7 @@ namespace base_entity
|
||||
#endregion
|
||||
|
||||
var objtsql1 = fsql.Select<object>().WithSql("select * from user1").ToList();
|
||||
var objtsql2 = fsql.Select<object>().WithSql("select * from user1").ToList<User1>();
|
||||
|
||||
var astsql = fsql.Select<AsTableLog, Sys_owner>()
|
||||
.InnerJoin((a, b) => a.id == b.Id)
|
||||
|
@ -371,7 +371,12 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public List<TDto> ToList<TDto>() => typeof(T1) == typeof(TDto) ? ToList() as List<TDto> : ToList(GetToListDtoSelector<TDto>());
|
||||
public List<TDto> ToList<TDto>()
|
||||
{
|
||||
if (typeof(T1) == typeof(TDto)) return ToList() as List<TDto>;
|
||||
if (_tables.FirstOrDefault()?.Table.Type == typeof(object)) return ToList<TDto>("*");
|
||||
return ToList(GetToListDtoSelector<TDto>());
|
||||
}
|
||||
Expression<Func<T1, TDto>> GetToListDtoSelector<TDto>()
|
||||
{
|
||||
var expParam = _tables[0].Parameter ?? Expression.Parameter(typeof(T1), "a");
|
||||
|
Loading…
x
Reference in New Issue
Block a user