Synchronous code

This commit is contained in:
sunkaixuan
2025-08-23 11:37:39 +08:00
parent d158b8b408
commit 306c5d08f6

View File

@@ -749,37 +749,6 @@ namespace SqlSugar
{
this.Context.Ado.Close();
}
}
public async IAsyncEnumerable<T> GetAsyncEnumerable()
{
var queryable = this.Clone();
var sql = queryable.ToSql();
var dr = await Context.Ado.GetDataReaderAsync(sql.Key, sql.Value).ConfigureAwait(false);
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>();
var columns = UtilMethods.GetColumnInfo(dr);
var cacheKey = "GetAsyncEnumerable" + typeof(T).GetHashCode() + string.Join(",", columns.Select(it => it.Item1 + it.Item2.Name + "_"));
IDataReaderEntityBuilder<T> entytyList = this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey, () =>
{
var cacheResult = new IDataReaderEntityBuilder<T>(this.Context, dr,
columns.Select(it => it.Item1).ToList()).CreateBuilder(typeof(T));
return cacheResult;
});
using (dr)
{
while (dr.Read())
{
var order = entytyList.Build(dr);
yield return order;
}
}
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection)
{
this.Context.Ado.Close();
}
}
public IEnumerable<T> GetEnumerable()
{