mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 优化 .Select<object>().WithSql(sql).ToList<T>() 体验;
This commit is contained in:
		@@ -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");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user