mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-10 11:25:00 +08:00
-
This commit is contained in:
@@ -349,10 +349,11 @@ namespace SqlSugar
|
|||||||
public List<T> ToList()
|
public List<T> ToList()
|
||||||
{
|
{
|
||||||
var sqlObj =this.ToSql();
|
var sqlObj =this.ToSql();
|
||||||
|
var isComplexModel = Regex.IsMatch(sqlObj.Key, @"AS \[\w+\.\w+\]");
|
||||||
using (var dataReader = this.Db.GetDataReader(sqlObj.Key, sqlObj.Value.ToArray()))
|
using (var dataReader = this.Db.GetDataReader(sqlObj.Key, sqlObj.Value.ToArray()))
|
||||||
{
|
{
|
||||||
var tType = typeof(T);
|
var tType = typeof(T);
|
||||||
if (tType.IsAnonymousType())
|
if (tType.IsAnonymousType()||isComplexModel)
|
||||||
{
|
{
|
||||||
return this.Context.RewritableMethods.DataReaderToDynamicList<T>(dataReader);
|
return this.Context.RewritableMethods.DataReaderToDynamicList<T>(dataReader);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user