Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dapper/CommandDefinition.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Data;
using System.Reflection;
using System.Reflection.Emit;
Expand All @@ -21,6 +22,8 @@ internal void OnCompleted()
(Parameters as SqlMapper.IParameterCallbacks)?.OnCompleted();
}

public IList? Buffer { get; }

/// <summary>
/// The command (sql or a stored-procedure name) to execute
/// </summary>
Expand Down Expand Up @@ -83,7 +86,7 @@ internal void OnCompleted()
/// <param name="cancellationToken">The cancellation token for this command.</param>
public CommandDefinition(string commandText, object? parameters = null, IDbTransaction? transaction = null, int? commandTimeout = null,
CommandType? commandType = null, CommandFlags flags = CommandFlags.Buffered
, CancellationToken cancellationToken = default
, CancellationToken cancellationToken = default, IList? buffer = null
)
{
CommandText = commandText;
Expand All @@ -93,6 +96,7 @@ public CommandDefinition(string commandText, object? parameters = null, IDbTrans
CommandTypeDirect = commandType ?? InferCommandType(commandText);
Flags = flags;
CancellationToken = cancellationToken;
Buffer = buffer;
}

internal static CommandType InferCommandType(string sql)
Expand Down
1 change: 1 addition & 0 deletions Dapper/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Dapper.CommandDefinition.CancellationToken.get -> System.Threading.CancellationT
Dapper.CommandDefinition.CommandDefinition() -> void
Dapper.CommandDefinition.CommandDefinition(string! commandText, object? parameters = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null, Dapper.CommandFlags flags = Dapper.CommandFlags.Buffered, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void
Dapper.CommandDefinition.CommandText.get -> string!
Dapper.CommandDefinition.Buffer.get -> IEnumerable?
Dapper.CommandDefinition.CommandTimeout.get -> int?
Dapper.CommandDefinition.CommandType.get -> System.Data.CommandType?
Dapper.CommandDefinition.Flags.get -> Dapper.CommandFlags
Expand Down
3 changes: 2 additions & 1 deletion Dapper/SqlMapper.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private static async Task<IEnumerable<T>> QueryAsync<T>(this IDbConnection cnn,

if (command.Buffered)
{
var buffer = new List<T>();
var buffer = command.Buffer as IList<T> ?? new List<T>();
var convertToType = Nullable.GetUnderlyingType(effectiveType) ?? effectiveType;
while (await reader.ReadAsync(cancel).ConfigureAwait(false))
{
Expand All @@ -473,6 +473,7 @@ private static async Task<IEnumerable<T>> QueryAsync<T>(this IDbConnection cnn,
if (wasClosed) cnn.Close();
}
}


private static async Task<T> QueryRowAsync<T>(this IDbConnection cnn, Row row, Type effectiveType, CommandDefinition command)
{
Expand Down