public override MultiSqlReader MultiResult() { DbCommand command = GetCommand(); var sqlReader = new MultiSqlReader(command, _sqlOrm); sqlReader.ExecuteReader(); return(sqlReader); }
private ValueTask <MultiSqlReader> CreateReaderAsync(DbCommand command, CancellationToken cancellationToken) { var sqlReader = new MultiSqlReader(command, _sqlOrm); try { ValueTask task = sqlReader.ExecuteReaderAsync(cancellationToken); if (task.IsCompletedSuccessfully) { task.GetAwaiter().GetResult(); return(ValueTask.FromResult(NullableHelper.SetNull(ref sqlReader))); } else { return(WaitAsync(task, NullableHelper.SetNull(ref sqlReader)));
static async ValueTask <MultiSqlReader> WaitAsync(ValueTask task, MultiSqlReader sqlReader) { var copy = sqlReader; try { await task.ConfigureAwait(false); return(NullableHelper.SetNull(ref copy)); } finally { copy?.Dispose(); } }