mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Synchronous code
This commit is contained in:
@@ -750,37 +750,6 @@ namespace SqlSugar
|
|||||||
this.Context.Ado.Close();
|
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()
|
public IEnumerable<T> GetEnumerable()
|
||||||
{
|
{
|
||||||
var queryable = this.Clone();
|
var queryable = this.Clone();
|
||||||
|
Reference in New Issue
Block a user