diff --git a/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.csproj b/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.csproj index f016f490a..1ce981720 100644 --- a/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.csproj +++ b/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.csproj @@ -4,7 +4,7 @@ Dapper: Entity Framework type handlers (with a strong name) Extension handlers for entity framework Marc Gravell;Nick Craver - net461 + net462 ../Dapper.snk true true diff --git a/Dapper.EntityFramework/Dapper.EntityFramework.csproj b/Dapper.EntityFramework/Dapper.EntityFramework.csproj index 0496d9c8f..aeb3dada8 100644 --- a/Dapper.EntityFramework/Dapper.EntityFramework.csproj +++ b/Dapper.EntityFramework/Dapper.EntityFramework.csproj @@ -5,7 +5,7 @@ Dapper entity framework type handlers 1.50.2 Marc Gravell;Nick Craver - net461 + net462 orm;sql;micro-orm enable diff --git a/Dapper.ProviderTools/Dapper.ProviderTools.csproj b/Dapper.ProviderTools/Dapper.ProviderTools.csproj index 61e8b4c58..6086925f7 100644 --- a/Dapper.ProviderTools/Dapper.ProviderTools.csproj +++ b/Dapper.ProviderTools/Dapper.ProviderTools.csproj @@ -5,7 +5,7 @@ Dapper Provider Tools Provider-agnostic ADO.NET helper utilities Marc Gravell - net461;netstandard2.0;net5.0 + net462;netstandard2.0;net5.0 true enable @@ -18,7 +18,7 @@ - + diff --git a/Dapper.Rainbow/Dapper.Rainbow.csproj b/Dapper.Rainbow/Dapper.Rainbow.csproj index 7d5f3ff5a..d44bc932f 100644 --- a/Dapper.Rainbow/Dapper.Rainbow.csproj +++ b/Dapper.Rainbow/Dapper.Rainbow.csproj @@ -6,7 +6,7 @@ Trivial micro-orm implemented on Dapper, provides with CRUD helpers. Sam Saffron 2017 Sam Saffron - net461;netstandard2.0;net5.0 + net462;netstandard2.0;net5.0 false @@ -16,7 +16,7 @@ - + \ No newline at end of file diff --git a/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj b/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj index b597bd9eb..b5b1decef 100644 --- a/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj +++ b/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj @@ -5,7 +5,7 @@ Dapper SqlBuilder component The Dapper SqlBuilder component, for building SQL queries dynamically. Sam Saffron, Johan Danforth - net461;netstandard2.0;net5.0 + net462;netstandard2.0;net5.0 false false enable @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/Dapper.StrongName/Dapper.StrongName.csproj b/Dapper.StrongName/Dapper.StrongName.csproj index dec6f7f0c..3727625d9 100644 --- a/Dapper.StrongName/Dapper.StrongName.csproj +++ b/Dapper.StrongName/Dapper.StrongName.csproj @@ -5,7 +5,7 @@ Dapper (Strong Named) A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc.. Sam Saffron;Marc Gravell;Nick Craver - net461;netstandard2.0;net5.0 + net462;netstandard2.0;net5.0 true true enable @@ -16,7 +16,12 @@ - + + + + + + diff --git a/Dapper/CommandFlags.cs b/Dapper/CommandFlags.cs index 45cd45d3e..d7eb42a55 100644 --- a/Dapper/CommandFlags.cs +++ b/Dapper/CommandFlags.cs @@ -24,5 +24,7 @@ public enum CommandFlags /// Should the plan cache be bypassed? /// NoCache = 4, + + // reserved: DisposeConnection = 1 << 30 } } diff --git a/Dapper/Dapper.csproj b/Dapper/Dapper.csproj index cf98d5abf..59d58192e 100644 --- a/Dapper/Dapper.csproj +++ b/Dapper/Dapper.csproj @@ -5,7 +5,7 @@ orm;sql;micro-orm A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc.. Sam Saffron;Marc Gravell;Nick Craver - net461;netstandard2.0;net5.0 + net462;netstandard2.0;net5.0;net7.0 enable true @@ -23,8 +23,12 @@ runtime; build; native; contentfiles; analyzers + + + - + + diff --git a/Dapper/DbConnectionExtensions.cs b/Dapper/DbConnectionExtensions.cs new file mode 100644 index 000000000..788e09769 --- /dev/null +++ b/Dapper/DbConnectionExtensions.cs @@ -0,0 +1,532 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Threading; +using System.Threading.Tasks; + +namespace Dapper; + +/// +/// Provides extension methods for performing database operations from instances. +/// +public static class DbConnectionExtensions +{ + internal const int DefaultTimeout = -1; + + /// + /// Execute a non-query command. + /// + /// The connection to query on. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// The transaction to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The number of rows affected. + public static int Execute(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute a non-query command. + /// + /// The connection to query on. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// The transaction to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The number of rows affected. + public static Task ExecuteAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a non-buffered query, returning the data typed as dynamic objects with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static IEnumerable QueryUnbuffered(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a non-buffered query, returning the data typed as dynamic objects with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static IAsyncEnumerable QueryUnbufferedAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query, returning the data as a list of dynamic objects with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static List Query(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query, returning the data as a list of dynamic objects with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task> QueryAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a non-buffered query, returning the data typed as . + /// + /// The type of results to return. + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// + /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static IEnumerable QueryUnbuffered(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a non-buffered query, returning the data typed as . + /// + /// The type of results to return. + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// + /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static IAsyncEnumerable QueryUnbufferedAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query, returning the data typed as a list of . + /// + /// The type of results to return. + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any.m> + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// + /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static List Query(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query, returning the data typed as a list of . + /// + /// The type of results to return. + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any.m> + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// + /// A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static Task> QueryAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + + /// + /// Executes a buffered query that demands at least one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic QueryFirst(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic QuerySingle(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic? QueryFirstOrDefault(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic? QuerySingleOrDefault(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at least one row, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T QueryFirst(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T QuerySingle(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T? QueryFirstOrDefault(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T? QuerySingleOrDefault(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + + /// + /// Executes a buffered query that demands at least one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstOrDefaultAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), returning the data as a dynamic object with properties matching the columns. + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleOrDefaultAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at least one row, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstOrDefaultAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), interpreting the data as a + /// + /// The connection to query on. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The transaction to use, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleOrDefaultAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL and return an . + /// + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional behaviour for this reader + /// Optional flags for this command + /// An that can be used to iterate over the results of the SQL query. + /// + /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a + /// or . + /// + /// + /// + /// + /// + /// + public static DbDataReader ExecuteReader(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandBehavior behavior = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL and return an . + /// + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional behaviour for this reader + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// An that can be used to iterate over the results of the SQL query. + /// + /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a + /// or . + /// + /// + /// + /// + /// + /// + public static Task ExecuteReaderAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandBehavior behavior = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + + /// + /// Execute a command that returns multiple result sets, and access each in turn. + /// + /// The connection to query on. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// The transaction to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + public static SqlMapper.GridReader QueryMultiple(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + => throw new NotImplementedException(); + + /// + /// Execute a command that returns multiple result sets, and access each in turn. + /// + /// The connection to query on. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// The transaction to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + public static Task QueryMultipleAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The first cell selected as . + public static object? ExecuteScalar(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The type to return. + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The first cell returned, as . + public static T? ExecuteScalar(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The first cell selected as . + public static Task ExecuteScalarAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The type to return. + /// The connection to execute on. + /// The SQL to execute. + /// The parameters to use for this command. + /// The transaction to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The first cell returned, as . + public static Task ExecuteScalarAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); +} diff --git a/Dapper/DbDataSourceExtensions.cs b/Dapper/DbDataSourceExtensions.cs new file mode 100644 index 000000000..c7562ffa0 --- /dev/null +++ b/Dapper/DbDataSourceExtensions.cs @@ -0,0 +1,534 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Threading; +using System.Threading.Tasks; + +#if NET7_0_OR_GREATER + +namespace Dapper; + +/// +/// Provides extension methods for performing database operations from instances. +/// +public static class DbDataSourceExtensions +{ + private const int DefaultTimeout = DbConnectionExtensions.DefaultTimeout; + internal const CommandFlags DisposeConnection = (CommandFlags)(1 << 30); + + /// + /// Execute a non-query command. + /// + /// The connection source. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The number of rows affected. + public static int Execute(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + { + return DbConnectionExtensions.Execute(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection); + } + + /// + /// Execute a non-query command. + /// + /// The connection source. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The number of rows affected. + public static Task ExecuteAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + { + return DbConnectionExtensions.ExecuteAsync(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection, cancellationToken); + } + + /// + /// Executes a non-buffered query, returning the data typed as dynamic objects with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static IEnumerable QueryUnbuffered(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + { + return DbConnectionExtensions.QueryUnbuffered(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection); + } + + /// + /// Executes a non-buffered query, returning the data typed as dynamic objects with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + /// Asynchronous cancellation for this command + public static IAsyncEnumerable QueryUnbufferedAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + { + return DbConnectionExtensions.QueryUnbufferedAsync(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection, cancellationToken); + } + + /// + /// Executes a buffered query, returning the data as a list of dynamic objects with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static List Query(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + { + return DbConnectionExtensions.Query(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection); + } + + /// + /// Executes a buffered query, returning the data as a list of dynamic objects with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + /// Asynchronous cancellation for this command + public static Task> QueryAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + { + return DbConnectionExtensions.QueryAsync(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection, cancellationToken); + } + + /// + /// Executes a non-buffered query, returning the data typed as . + /// + /// The type of results to return. + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// + /// A sequence of data of the supplied type ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static IEnumerable QueryUnbuffered(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + { + return DbConnectionExtensions.QueryUnbuffered(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection); + } + + /// + /// Executes a non-buffered query, returning the data typed as . + /// + /// The type of results to return. + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// + /// A sequence of data of the supplied type ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static IAsyncEnumerable QueryUnbufferedAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + { + return DbConnectionExtensions.QueryUnbufferedAsync(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection, cancellationToken); + } + + /// + /// Executes a buffered query, returning the data typed as a list of . + /// + /// The type of results to return. + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// + /// A list of data of the supplied type ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static List Query(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + { + return DbConnectionExtensions.Query(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection); + } + + /// + /// Executes a buffered query, returning the data typed as a list of . + /// + /// The type of results to return. + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// + /// A list of data of the supplied type ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is + /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + /// + public static async Task> QueryAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + { + return await DbConnectionExtensions.QueryAsync(source.CreateConnection(), sql, param, null, commandTimeout, commandType, flags | DisposeConnection, cancellationToken); + } + + /// + /// Executes a buffered query that demands at least one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic QueryFirst(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic QuerySingle(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic? QueryFirstOrDefault(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static dynamic? QuerySingleOrDefault(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at least one row, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T QueryFirst(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T QuerySingle(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T? QueryFirstOrDefault(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static T? QuerySingleOrDefault(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + + /// + /// Executes a buffered query that demands at least one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstOrDefaultAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), returning the data as a dynamic object with properties matching the columns. + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleOrDefaultAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at least one row, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands exactly one row, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that returns the first row or null if no rows at returned, interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QueryFirstOrDefaultAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Executes a buffered query that demands at most one row (returning null if no rows at returned), interpreting the data as a + /// + /// The connection source. + /// The SQL to execute for the query. + /// The parameters to pass, if any. + /// The command timeout (in seconds). + /// The type of command to execute. + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> + public static Task QuerySingleOrDefaultAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + + /// + /// Execute parameterized SQL and return an . + /// + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional behaviour for this reader + /// Optional flags for this command + /// An that can be used to iterate over the results of the SQL query. + /// + /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a + /// or . + /// + /// + /// + /// + /// + /// + public static DbDataReader ExecuteReader(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandBehavior behavior = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL and return an . + /// + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional behaviour for this reader + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// An that can be used to iterate over the results of the SQL query. + /// + /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a + /// or . + /// + /// + /// + /// + /// + /// + public static Task ExecuteReaderAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandBehavior behavior = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + + /// + /// Execute a command that returns multiple result sets, and access each in turn. + /// + /// The connection source. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + public static SqlMapper.GridReader QueryMultiple(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default) + => throw new NotImplementedException(); + + /// + /// Execute a command that returns multiple result sets, and access each in turn. + /// + /// The connection source. + /// The SQL to execute for this query. + /// The parameters to use for this query. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + public static Task QueryMultipleAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) + => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The first cell selected as . + public static object? ExecuteScalar(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The type to return. + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// The first cell returned, as . + public static T? ExecuteScalar(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The first cell selected as . + public static Task ExecuteScalarAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + /// + /// Execute parameterized SQL that selects a single value. + /// + /// The type to return. + /// The connection source. + /// The SQL to execute. + /// The parameters to use for this command. + /// Number of seconds before command execution timeout. + /// Is it a stored proc or a batch? + /// Optional flags for this command + /// Asynchronous cancellation for this command + /// The first cell returned, as . + public static Task ExecuteScalarAsync(this DbDataSource source, string sql, object? param = null, int commandTimeout = DefaultTimeout, + CommandType commandType = default, CommandFlags flags = default, CancellationToken cancellationToken = default) => throw new NotImplementedException(); +} + + +#endif diff --git a/Dapper/PublicAPI.Shipped.txt b/Dapper/PublicAPI.Shipped.txt index 4c5417a6c..e7424b7bd 100644 --- a/Dapper/PublicAPI.Shipped.txt +++ b/Dapper/PublicAPI.Shipped.txt @@ -178,27 +178,27 @@ static Dapper.SqlMapper.AsTableValuedParameter(this System.Collections.Generi static Dapper.SqlMapper.ConnectionStringComparer.get -> System.Collections.Generic.IEqualityComparer! static Dapper.SqlMapper.ConnectionStringComparer.set -> void static Dapper.SqlMapper.CreateParamInfoGenerator(Dapper.SqlMapper.Identity! identity, bool checkForDuplicates, bool removeUnused) -> System.Action! -static Dapper.SqlMapper.Execute(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> int -static Dapper.SqlMapper.Execute(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> int -static Dapper.SqlMapper.ExecuteAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReader(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Data.IDataReader! -static Dapper.SqlMapper.ExecuteReader(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Data.IDataReader! -static Dapper.SqlMapper.ExecuteReader(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Data.IDataReader! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.Common.DbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.Common.DbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteReaderAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteScalar(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> object? -static Dapper.SqlMapper.ExecuteScalar(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? -static Dapper.SqlMapper.ExecuteScalar(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? -static Dapper.SqlMapper.ExecuteScalar(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? -static Dapper.SqlMapper.ExecuteScalarAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteScalarAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteScalarAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.ExecuteScalarAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.Execute(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> int +static Dapper.SqlMapper.Execute(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> int +static Dapper.SqlMapper.ExecuteAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReader(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Data.IDataReader! +static Dapper.SqlMapper.ExecuteReader(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Data.IDataReader! +static Dapper.SqlMapper.ExecuteReader(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Data.IDataReader! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.Common.DbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.Common.DbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Data.CommandBehavior commandBehavior) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteReaderAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteScalar(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> object? +static Dapper.SqlMapper.ExecuteScalar(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? +static Dapper.SqlMapper.ExecuteScalar(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? +static Dapper.SqlMapper.ExecuteScalar(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? +static Dapper.SqlMapper.ExecuteScalarAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteScalarAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteScalarAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.ExecuteScalarAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! static Dapper.SqlMapper.FindOrAddParameter(System.Data.IDataParameterCollection! parameters, System.Data.IDbCommand! command, string! name) -> System.Data.IDbDataParameter! static Dapper.SqlMapper.Format(object? value) -> string! static Dapper.SqlMapper.GetCachedSQL(int ignoreHitCountAbove = 2147483647) -> System.Collections.Generic.IEnumerable!>! @@ -219,81 +219,81 @@ static Dapper.SqlMapper.Parse(this System.Data.IDataReader! reader) -> System.Co static Dapper.SqlMapper.Parse(this System.Data.IDataReader! reader, System.Type! type) -> System.Collections.Generic.IEnumerable! static Dapper.SqlMapper.Parse(this System.Data.IDataReader! reader) -> System.Collections.Generic.IEnumerable! static Dapper.SqlMapper.PurgeQueryCache() -> void -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.Query(this System.Data.IDbConnection! cnn, string! sql, System.Type![]! types, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! -static Dapper.SqlMapper.QueryAsync(this System.Data.IDbConnection! cnn, string! sql, System.Type![]! types, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.Query(System.Data.IDbConnection! cnn, string! sql, System.Type![]! types, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IEnumerable! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command, System.Func! map, string! splitOn = "Id") -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! +static Dapper.SqlMapper.QueryAsync(System.Data.IDbConnection! cnn, string! sql, System.Type![]! types, System.Func! map, object? param = null, System.Data.IDbTransaction? transaction = null, bool buffered = true, string! splitOn = "Id", int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task!>! static Dapper.SqlMapper.QueryCachePurged -> System.EventHandler? -static Dapper.SqlMapper.QueryFirst(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic! -static Dapper.SqlMapper.QueryFirst(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object! -static Dapper.SqlMapper.QueryFirst(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T -static Dapper.SqlMapper.QueryFirst(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefault(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic? -static Dapper.SqlMapper.QueryFirstOrDefault(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? -static Dapper.SqlMapper.QueryFirstOrDefault(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? -static Dapper.SqlMapper.QueryFirstOrDefault(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryFirstOrDefaultAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryMultiple(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> Dapper.SqlMapper.GridReader! -static Dapper.SqlMapper.QueryMultiple(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> Dapper.SqlMapper.GridReader! -static Dapper.SqlMapper.QueryMultipleAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QueryMultipleAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingle(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic! -static Dapper.SqlMapper.QuerySingle(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object! -static Dapper.SqlMapper.QuerySingle(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T -static Dapper.SqlMapper.QuerySingle(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefault(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic? -static Dapper.SqlMapper.QuerySingleOrDefault(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? -static Dapper.SqlMapper.QuerySingleOrDefault(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? -static Dapper.SqlMapper.QuerySingleOrDefault(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! -static Dapper.SqlMapper.QuerySingleOrDefaultAsync(this System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirst(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic! +static Dapper.SqlMapper.QueryFirst(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object! +static Dapper.SqlMapper.QueryFirst(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T +static Dapper.SqlMapper.QueryFirst(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefault(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic? +static Dapper.SqlMapper.QueryFirstOrDefault(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? +static Dapper.SqlMapper.QueryFirstOrDefault(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? +static Dapper.SqlMapper.QueryFirstOrDefault(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryFirstOrDefaultAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryMultiple(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> Dapper.SqlMapper.GridReader! +static Dapper.SqlMapper.QueryMultiple(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> Dapper.SqlMapper.GridReader! +static Dapper.SqlMapper.QueryMultipleAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QueryMultipleAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingle(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic! +static Dapper.SqlMapper.QuerySingle(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object! +static Dapper.SqlMapper.QuerySingle(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T +static Dapper.SqlMapper.QuerySingle(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefault(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> dynamic? +static Dapper.SqlMapper.QuerySingleOrDefault(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> object? +static Dapper.SqlMapper.QuerySingleOrDefault(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> T? +static Dapper.SqlMapper.QuerySingleOrDefault(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> T? +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, System.Type! type, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, System.Type! type, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, Dapper.CommandDefinition command) -> System.Threading.Tasks.Task! +static Dapper.SqlMapper.QuerySingleOrDefaultAsync(System.Data.IDbConnection! cnn, string! sql, object? param = null, System.Data.IDbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Threading.Tasks.Task! static Dapper.SqlMapper.ReadChar(object! value) -> char static Dapper.SqlMapper.ReadNullableChar(object! value) -> char? static Dapper.SqlMapper.RemoveTypeMap(System.Type! type) -> void @@ -325,4 +325,9 @@ static Dapper.SqlMapper.SetTypeName(this System.Data.DataTable! table, string! t static Dapper.SqlMapper.ThrowDataException(System.Exception! ex, int index, System.Data.IDataReader! reader, object? value) -> void static Dapper.SqlMapper.TypeHandlerCache.Parse(object! value) -> T? static Dapper.SqlMapper.TypeHandlerCache.SetValue(System.Data.IDbDataParameter! parameter, object! value) -> void -static Dapper.SqlMapper.TypeMapProvider -> System.Func! \ No newline at end of file +static Dapper.SqlMapper.TypeMapProvider -> System.Func! +Dapper.SqlMapper.GridReader.DisposeAsync() -> System.Threading.Tasks.ValueTask +Dapper.SqlMapper.GridReader.ReadUnbufferedAsync() -> System.Collections.Generic.IAsyncEnumerable! +Dapper.SqlMapper.GridReader.ReadUnbufferedAsync() -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.SqlMapper.QueryUnbufferedAsync(System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.SqlMapper.QueryUnbufferedAsync(System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable! \ No newline at end of file diff --git a/Dapper/PublicAPI.Unshipped.txt b/Dapper/PublicAPI.Unshipped.txt index 91b0e1a43..8aede0a25 100644 --- a/Dapper/PublicAPI.Unshipped.txt +++ b/Dapper/PublicAPI.Unshipped.txt @@ -1 +1,37 @@ -#nullable enable \ No newline at end of file +#nullable enable +Dapper.DbConnectionExtensions +static Dapper.DbConnectionExtensions.Execute(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> int +static Dapper.DbConnectionExtensions.ExecuteAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.ExecuteReader(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, System.Data.CommandBehavior behavior = System.Data.CommandBehavior.Default, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Data.Common.DbDataReader! +static Dapper.DbConnectionExtensions.ExecuteReaderAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, System.Data.CommandBehavior behavior = System.Data.CommandBehavior.Default, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.ExecuteScalar(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> object? +static Dapper.DbConnectionExtensions.ExecuteScalar(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbConnectionExtensions.ExecuteScalarAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.ExecuteScalarAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.Query(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.List! +static Dapper.DbConnectionExtensions.Query(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.List! +static Dapper.DbConnectionExtensions.QueryAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!>! +static Dapper.DbConnectionExtensions.QueryAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!>! +static Dapper.DbConnectionExtensions.QueryFirst(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic! +static Dapper.DbConnectionExtensions.QueryFirst(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T +static Dapper.DbConnectionExtensions.QueryFirstAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QueryFirstAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QueryFirstOrDefault(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic? +static Dapper.DbConnectionExtensions.QueryFirstOrDefault(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbConnectionExtensions.QueryFirstOrDefaultAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QueryFirstOrDefaultAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QueryMultiple(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> Dapper.SqlMapper.GridReader! +static Dapper.DbConnectionExtensions.QueryMultipleAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QuerySingle(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic! +static Dapper.DbConnectionExtensions.QuerySingle(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T +static Dapper.DbConnectionExtensions.QuerySingleAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QuerySingleAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QuerySingleOrDefault(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic? +static Dapper.DbConnectionExtensions.QuerySingleOrDefault(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbConnectionExtensions.QuerySingleOrDefaultAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QuerySingleOrDefaultAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbConnectionExtensions.QueryUnbuffered(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.IEnumerable! +static Dapper.DbConnectionExtensions.QueryUnbuffered(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.IEnumerable! +static Dapper.DbConnectionExtensions.QueryUnbufferedAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.DbConnectionExtensions.QueryUnbufferedAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.SqlMapper.AsList(this System.Collections.Generic.List! source) -> System.Collections.Generic.List! \ No newline at end of file diff --git a/Dapper/PublicAPI/net5.0/PublicAPI.Shipped.txt b/Dapper/PublicAPI/net5.0/PublicAPI.Shipped.txt index 5da46e604..91b0e1a43 100644 --- a/Dapper/PublicAPI/net5.0/PublicAPI.Shipped.txt +++ b/Dapper/PublicAPI/net5.0/PublicAPI.Shipped.txt @@ -1,6 +1 @@ -#nullable enable -Dapper.SqlMapper.GridReader.DisposeAsync() -> System.Threading.Tasks.ValueTask -Dapper.SqlMapper.GridReader.ReadUnbufferedAsync() -> System.Collections.Generic.IAsyncEnumerable! -Dapper.SqlMapper.GridReader.ReadUnbufferedAsync() -> System.Collections.Generic.IAsyncEnumerable! -static Dapper.SqlMapper.QueryUnbufferedAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable! -static Dapper.SqlMapper.QueryUnbufferedAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable! \ No newline at end of file +#nullable enable \ No newline at end of file diff --git a/Dapper/PublicAPI/net7.0/PublicAPI.Shipped.txt b/Dapper/PublicAPI/net7.0/PublicAPI.Shipped.txt new file mode 100644 index 000000000..ab058de62 --- /dev/null +++ b/Dapper/PublicAPI/net7.0/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/Dapper/PublicAPI/net7.0/PublicAPI.Unshipped.txt b/Dapper/PublicAPI/net7.0/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..887954e53 --- /dev/null +++ b/Dapper/PublicAPI/net7.0/PublicAPI.Unshipped.txt @@ -0,0 +1,36 @@ +#nullable enable +Dapper.DbDataSourceExtensions +static Dapper.DbDataSourceExtensions.Execute(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> int +static Dapper.DbDataSourceExtensions.Query(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.List! +static Dapper.DbDataSourceExtensions.Query(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.List! +static Dapper.DbDataSourceExtensions.QueryUnbuffered(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.IEnumerable! +static Dapper.DbDataSourceExtensions.QueryUnbuffered(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Collections.Generic.IEnumerable! +static Dapper.DbDataSourceExtensions.ExecuteAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!>! +static Dapper.DbDataSourceExtensions.QueryAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!>! +static Dapper.DbDataSourceExtensions.QueryUnbufferedAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.DbDataSourceExtensions.QueryUnbufferedAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IAsyncEnumerable! +static Dapper.DbDataSourceExtensions.ExecuteReader(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, System.Data.CommandBehavior behavior = System.Data.CommandBehavior.Default, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> System.Data.Common.DbDataReader! +static Dapper.DbDataSourceExtensions.ExecuteReaderAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, System.Data.CommandBehavior behavior = System.Data.CommandBehavior.Default, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.ExecuteScalar(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> object? +static Dapper.DbDataSourceExtensions.ExecuteScalar(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbDataSourceExtensions.ExecuteScalarAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.ExecuteScalarAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryFirst(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic! +static Dapper.DbDataSourceExtensions.QueryFirst(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T +static Dapper.DbDataSourceExtensions.QueryFirstAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryFirstAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryFirstOrDefault(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic? +static Dapper.DbDataSourceExtensions.QueryFirstOrDefault(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbDataSourceExtensions.QueryFirstOrDefaultAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryFirstOrDefaultAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QueryMultiple(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> Dapper.SqlMapper.GridReader! +static Dapper.DbDataSourceExtensions.QueryMultipleAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QuerySingle(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic! +static Dapper.DbDataSourceExtensions.QuerySingle(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T +static Dapper.DbDataSourceExtensions.QuerySingleAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QuerySingleAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QuerySingleOrDefault(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> dynamic? +static Dapper.DbDataSourceExtensions.QuerySingleOrDefault(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None) -> T? +static Dapper.DbDataSourceExtensions.QuerySingleOrDefaultAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +static Dapper.DbDataSourceExtensions.QuerySingleOrDefaultAsync(this System.Data.Common.DbDataSource! source, string! sql, object? param = null, int commandTimeout = -1, System.Data.CommandType commandType = (System.Data.CommandType)0, Dapper.CommandFlags flags = Dapper.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! diff --git a/Dapper/SqlMapper.Async.cs b/Dapper/SqlMapper.Async.cs index 6fb8ca4c2..4c5c6c6d4 100644 --- a/Dapper/SqlMapper.Async.cs +++ b/Dapper/SqlMapper.Async.cs @@ -24,7 +24,7 @@ public static partial class SqlMapper /// The type of command to execute. /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryAsync(cnn, typeof(DapperRow), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered, default)); /// @@ -33,7 +33,7 @@ public static partial class SqlMapper /// The connection to query on. /// The command used to query on this connection. /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command) => QueryAsync(cnn, typeof(DapperRow), command); /// @@ -42,7 +42,7 @@ public static partial class SqlMapper /// The connection to query on. /// The command used to query on this connection. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> - public static Task QueryFirstAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QueryFirstAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.First, typeof(DapperRow), command); /// @@ -51,7 +51,7 @@ public static partial class SqlMapper /// The connection to query on. /// The command used to query on this connection. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.FirstOrDefault, typeof(DapperRow), command); /// @@ -60,7 +60,7 @@ public static partial class SqlMapper /// The connection to query on. /// The command used to query on this connection. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> - public static Task QuerySingleAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QuerySingleAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.Single, typeof(DapperRow), command); /// @@ -69,7 +69,7 @@ public static partial class SqlMapper /// The connection to query on. /// The command used to query on this connection. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.SingleOrDefault, typeof(DapperRow), command); /// @@ -87,7 +87,7 @@ public static partial class SqlMapper /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryAsync(cnn, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered, default)); /// @@ -101,7 +101,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QueryFirstAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.First, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -115,7 +115,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.FirstOrDefault, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -129,7 +129,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QuerySingleAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.Single, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -143,7 +143,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.SingleOrDefault, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -156,7 +156,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QueryFirstAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.First, typeof(DapperRow), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -169,7 +169,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.FirstOrDefault, typeof(DapperRow), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -182,7 +182,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QuerySingleAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.Single, typeof(DapperRow), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -195,7 +195,7 @@ public static partial class SqlMapper /// The command timeout (in seconds). /// The type of command to execute. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryRowAsync(cnn, Row.SingleOrDefault, typeof(DapperRow), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); /// @@ -210,7 +210,7 @@ public static partial class SqlMapper /// The type of command to execute. /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static Task> QueryAsync(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); return QueryAsync(cnn, type, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered, default)); @@ -228,7 +228,7 @@ public static Task> QueryAsync(this IDbConnection cnn, Type /// The type of command to execute. /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstAsync(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static Task QueryFirstAsync(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); return QueryRowAsync(cnn, Row.First, type, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); @@ -245,7 +245,7 @@ public static Task QueryFirstAsync(this IDbConnection cnn, Type type, st /// The type of command to execute. /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); return QueryRowAsync(cnn, Row.FirstOrDefault, type, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); @@ -262,7 +262,7 @@ public static Task QueryFirstAsync(this IDbConnection cnn, Type type, st /// The type of command to execute. /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleAsync(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static Task QuerySingleAsync(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); return QueryRowAsync(cnn, Row.Single, type, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); @@ -279,7 +279,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The type of command to execute. /// is null. [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); return QueryRowAsync(cnn, Row.SingleOrDefault, type, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); @@ -295,7 +295,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command) => QueryAsync(cnn, typeof(T), command); /// @@ -304,7 +304,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The connection to query on. /// The type to return. /// The command used to query on this connection. - public static Task> QueryAsync(this IDbConnection cnn, Type type, CommandDefinition command) => + public static Task> QueryAsync(IDbConnection cnn, Type type, CommandDefinition command) => QueryAsync(cnn, type, command); /// @@ -313,7 +313,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The connection to query on. /// The type to return. /// The command used to query on this connection. - public static Task QueryFirstAsync(this IDbConnection cnn, Type type, CommandDefinition command) => + public static Task QueryFirstAsync(IDbConnection cnn, Type type, CommandDefinition command) => QueryRowAsync(cnn, Row.First, type, command); /// @@ -322,7 +322,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The type to return. /// The connection to query on. /// The command used to query on this connection. - public static Task QueryFirstAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QueryFirstAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.First, typeof(T), command); /// @@ -331,7 +331,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The connection to query on. /// The type to return. /// The command used to query on this connection. - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, Type type, CommandDefinition command) => + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, Type type, CommandDefinition command) => QueryRowAsync(cnn, Row.FirstOrDefault, type, command); /// @@ -340,7 +340,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The type to return. /// The connection to query on. /// The command used to query on this connection. - public static Task QueryFirstOrDefaultAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QueryFirstOrDefaultAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.FirstOrDefault, typeof(T), command); /// @@ -349,7 +349,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The connection to query on. /// The type to return. /// The command used to query on this connection. - public static Task QuerySingleAsync(this IDbConnection cnn, Type type, CommandDefinition command) => + public static Task QuerySingleAsync(IDbConnection cnn, Type type, CommandDefinition command) => QueryRowAsync(cnn, Row.Single, type, command); /// @@ -358,7 +358,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The type to return. /// The connection to query on. /// The command used to query on this connection. - public static Task QuerySingleAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QuerySingleAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.Single, typeof(T), command); /// @@ -367,7 +367,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The connection to query on. /// The type to return. /// The command used to query on this connection. - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, Type type, CommandDefinition command) => + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, Type type, CommandDefinition command) => QueryRowAsync(cnn, Row.SingleOrDefault, type, command); /// @@ -376,7 +376,7 @@ public static Task QuerySingleAsync(this IDbConnection cnn, Type type, s /// The type to return. /// The connection to query on. /// The command used to query on this connection. - public static Task QuerySingleOrDefaultAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task QuerySingleOrDefaultAsync(IDbConnection cnn, CommandDefinition command) => QueryRowAsync(cnn, Row.SingleOrDefault, typeof(T), command); private static Task ExecuteReaderWithFlagsFallbackAsync(DbCommand cmd, bool wasClosed, CommandBehavior behavior, CancellationToken cancellationToken) @@ -419,7 +419,7 @@ private static DbCommand TrySetupAsyncCommand(this CommandDefinition command, ID } } - private static async Task> QueryAsync(this IDbConnection cnn, Type effectiveType, CommandDefinition command) + private static async Task> QueryAsync(IDbConnection cnn, Type effectiveType, CommandDefinition command) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, effectiveType, param?.GetType()); @@ -474,7 +474,7 @@ private static async Task> QueryAsync(this IDbConnection cnn, } } - private static async Task QueryRowAsync(this IDbConnection cnn, Row row, Type effectiveType, CommandDefinition command) + private static async Task QueryRowAsync(IDbConnection cnn, Row row, Type effectiveType, CommandDefinition command) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, effectiveType, param?.GetType()); @@ -522,7 +522,7 @@ private static async Task QueryRowAsync(this IDbConnection cnn, Row row, T /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The number of rows affected. - public static Task ExecuteAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task ExecuteAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => ExecuteAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered, default)); /// @@ -531,7 +531,7 @@ private static async Task QueryRowAsync(this IDbConnection cnn, Row row, T /// The connection to execute on. /// The command to execute on this connection. /// The number of rows affected. - public static Task ExecuteAsync(this IDbConnection cnn, CommandDefinition command) + public static Task ExecuteAsync(IDbConnection cnn, CommandDefinition command) { object? param = command.Parameters; IEnumerable? multiExec = GetMultiExec(param); @@ -687,7 +687,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -704,7 +704,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); /// @@ -726,7 +726,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -744,7 +744,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); /// @@ -767,7 +767,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -786,7 +786,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); /// @@ -810,7 +810,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -830,7 +830,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); /// @@ -855,7 +855,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -876,7 +876,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); /// @@ -902,7 +902,7 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static Task> QueryAsync(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMapAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default), map, splitOn); @@ -924,10 +924,10 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// The function to map row types to the return type. /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => + public static Task> QueryAsync(IDbConnection cnn, CommandDefinition command, Func map, string splitOn = "Id") => MultiMapAsync(cnn, command, map, splitOn); - private static async Task> MultiMapAsync(this IDbConnection cnn, CommandDefinition command, Delegate map, string splitOn) + private static async Task> MultiMapAsync(IDbConnection cnn, CommandDefinition command, Delegate map, string splitOn) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, typeof(TFirst), param?.GetType()); @@ -965,13 +965,13 @@ private static async Task ExecuteImplAsync(IDbConnection cnn, CommandDefini /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task> QueryAsync(this IDbConnection cnn, string sql, Type[] types, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) + public static Task> QueryAsync(IDbConnection cnn, string sql, Type[] types, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None, default); return MultiMapAsync(cnn, command, types, map, splitOn); } - private static async Task> MultiMapAsync(this IDbConnection cnn, CommandDefinition command, Type[] types, Func map, string splitOn) + private static async Task> MultiMapAsync(IDbConnection cnn, CommandDefinition command, Type[] types, Func map, string splitOn) { if (types.Length < 1) { @@ -1018,7 +1018,7 @@ private static IEnumerable ExecuteReaderSync(DbDataReader reader, FuncThe transaction to use for this query. /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? - public static Task QueryMultipleAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task QueryMultipleAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryMultipleAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered)); /// @@ -1026,7 +1026,7 @@ private static IEnumerable ExecuteReaderSync(DbDataReader reader, Func /// The connection to query on. /// The command to execute for this query. - public static async Task QueryMultipleAsync(this IDbConnection cnn, CommandDefinition command) + public static async Task QueryMultipleAsync(IDbConnection cnn, CommandDefinition command) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, typeof(GridReader), param?.GetType()); @@ -1093,7 +1093,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task ExecuteReaderAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task ExecuteReaderAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => ExecuteWrappedReaderImplAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered), CommandBehavior.Default).CastResult(); /// @@ -1106,7 +1106,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static Task ExecuteReaderAsync(this DbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task ExecuteReaderAsync(DbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => ExecuteWrappedReaderImplAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered), CommandBehavior.Default); /// @@ -1119,7 +1119,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a /// or . /// - public static Task ExecuteReaderAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task ExecuteReaderAsync(IDbConnection cnn, CommandDefinition command) => ExecuteWrappedReaderImplAsync(cnn, command, CommandBehavior.Default).CastResult(); /// @@ -1127,7 +1127,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// /// The connection to execute on. /// The command to execute. - public static Task ExecuteReaderAsync(this DbConnection cnn, CommandDefinition command) => + public static Task ExecuteReaderAsync(DbConnection cnn, CommandDefinition command) => ExecuteWrappedReaderImplAsync(cnn, command, CommandBehavior.Default); /// @@ -1141,7 +1141,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a /// or . /// - public static Task ExecuteReaderAsync(this IDbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) => + public static Task ExecuteReaderAsync(IDbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) => ExecuteWrappedReaderImplAsync(cnn, command, commandBehavior).CastResult(); /// @@ -1150,7 +1150,7 @@ public static async Task QueryMultipleAsync(this IDbConnection cnn, /// The connection to execute on. /// The command to execute. /// The flags for this reader. - public static Task ExecuteReaderAsync(this DbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) => + public static Task ExecuteReaderAsync(DbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) => ExecuteWrappedReaderImplAsync(cnn, command, commandBehavior); private static async Task ExecuteWrappedReaderImplAsync(IDbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) @@ -1185,7 +1185,7 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The first cell returned, as . - public static Task ExecuteScalarAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task ExecuteScalarAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => ExecuteScalarImplAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered)); /// @@ -1199,7 +1199,7 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The first cell returned, as . - public static Task ExecuteScalarAsync(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static Task ExecuteScalarAsync(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => ExecuteScalarImplAsync(cnn, new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered)); /// @@ -1208,7 +1208,7 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect /// The connection to execute on. /// The command to execute. /// The first cell selected as . - public static Task ExecuteScalarAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task ExecuteScalarAsync(IDbConnection cnn, CommandDefinition command) => ExecuteScalarImplAsync(cnn, command); /// @@ -1218,7 +1218,7 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect /// The connection to execute on. /// The command to execute. /// The first cell selected as . - public static Task ExecuteScalarAsync(this IDbConnection cnn, CommandDefinition command) => + public static Task ExecuteScalarAsync(IDbConnection cnn, CommandDefinition command) => ExecuteScalarImplAsync(cnn, command); private static async Task ExecuteScalarImplAsync(IDbConnection cnn, CommandDefinition command) @@ -1249,7 +1249,6 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect return Parse(result); } -#if NET5_0_OR_GREATER /// /// Execute a query asynchronously using . /// @@ -1262,7 +1261,7 @@ private static async Task ExecuteWrappedReaderImplAsync(IDbConnect /// /// A sequence of data of dynamic data /// - public static IAsyncEnumerable QueryUnbufferedAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static IAsyncEnumerable QueryUnbufferedAsync(DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { // note: in many cases of adding a new async method I might add a CancellationToken - however, cancellation is expressed via WithCancellation on iterators return QueryUnbufferedAsync(cnn, typeof(object), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); @@ -1282,13 +1281,13 @@ public static IAsyncEnumerable QueryUnbufferedAsync(this DbConnection c /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static IAsyncEnumerable QueryUnbufferedAsync(this DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static IAsyncEnumerable QueryUnbufferedAsync(DbConnection cnn, string sql, object? param = null, DbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { // note: in many cases of adding a new async method I might add a CancellationToken - however, cancellation is expressed via WithCancellation on iterators return QueryUnbufferedAsync(cnn, typeof(T), new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None, default)); } - private static IAsyncEnumerable QueryUnbufferedAsync(this IDbConnection cnn, Type effectiveType, CommandDefinition command) + private static IAsyncEnumerable QueryUnbufferedAsync(IDbConnection cnn, Type effectiveType, CommandDefinition command) { return Impl(cnn, effectiveType, command, command.CancellationToken); // proxy to allow CT expression @@ -1333,12 +1332,15 @@ private static IAsyncEnumerable QueryUnbufferedAsync(this IDbConnection cn { if (reader is not null) { +#if NET5_0_OR_GREATER await reader.DisposeAsync(); +#else + reader.Dispose(); +#endif } if (wasClosed) cnn.Close(); } } } -#endif } } diff --git a/Dapper/SqlMapper.DapperRow.Descriptor.cs b/Dapper/SqlMapper.DapperRow.Descriptor.cs index 11e85c02d..0824c6658 100644 --- a/Dapper/SqlMapper.DapperRow.Descriptor.cs +++ b/Dapper/SqlMapper.DapperRow.Descriptor.cs @@ -13,8 +13,8 @@ private sealed class DapperRowTypeDescriptionProvider : TypeDescriptionProvider { public override ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) => new DapperRowTypeDescriptor(instance); - public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) - => new DapperRowTypeDescriptor(instance); + public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object? instance) + => new DapperRowTypeDescriptor(instance!); } //// in theory we could implement this for zero-length results to bind; would require @@ -57,7 +57,7 @@ AttributeCollection ICustomTypeDescriptor.GetAttributes() EventDescriptorCollection ICustomTypeDescriptor.GetEvents() => EventDescriptorCollection.Empty; - EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) => EventDescriptorCollection.Empty; + EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[]? attributes) => EventDescriptorCollection.Empty; internal static PropertyDescriptorCollection GetProperties(DapperRow row) => GetProperties(row?.table, row); internal static PropertyDescriptorCollection GetProperties(DapperTable? table, IDictionary? row = null) @@ -75,9 +75,9 @@ internal static PropertyDescriptorCollection GetProperties(DapperTable? table, I } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() => GetProperties(_row); - PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) => GetProperties(_row); + PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? attributes) => GetProperties(_row); - object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) => _row; + object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor? pd) => _row; } private sealed class RowBoundPropertyDescriptor : PropertyDescriptor @@ -95,10 +95,10 @@ public RowBoundPropertyDescriptor(Type type, string name, int index) : base(name public override bool ShouldSerializeValue(object component) => ((DapperRow)component).TryGetValue(_index, out _); public override Type ComponentType => typeof(DapperRow); public override Type PropertyType => _type; - public override object GetValue(object component) - => ((DapperRow)component).TryGetValue(_index, out var val) ? (val ?? DBNull.Value): DBNull.Value; - public override void SetValue(object component, object? value) - => ((DapperRow)component).SetValue(_index, value is DBNull ? null : value); + public override object GetValue(object? component) + => ((DapperRow)component!).TryGetValue(_index, out var val) ? (val ?? DBNull.Value): DBNull.Value; + public override void SetValue(object? component, object? value) + => ((DapperRow)component!).SetValue(_index, value is DBNull ? null : value); } } } diff --git a/Dapper/SqlMapper.GridReader.Async.cs b/Dapper/SqlMapper.GridReader.Async.cs index 5b5b9b73d..ca4c36d3e 100644 --- a/Dapper/SqlMapper.GridReader.Async.cs +++ b/Dapper/SqlMapper.GridReader.Async.cs @@ -10,9 +10,7 @@ namespace Dapper public static partial class SqlMapper { public partial class GridReader -#if NET5_0_OR_GREATER : IAsyncDisposable -#endif { /// /// Read the next grid of results, returned as a dynamic object @@ -247,7 +245,6 @@ private async Task> ReadBufferedAsync(int index, Func /// Read the next grid of results. /// @@ -283,29 +280,42 @@ private async IAsyncEnumerable ReadUnbufferedAsync(int index, Func /// Dispose the grid, closing and disposing both the underlying reader and command. /// - public async ValueTask DisposeAsync() + public +#if NET5_0_OR_GREATER + async +#endif + ValueTask DisposeAsync() { if (reader is not null) { if (!reader.IsClosed) Command?.Cancel(); +#if NET5_0_OR_GREATER await reader.DisposeAsync(); +#else + reader.Dispose(); +#endif reader = null!; } if (Command is not null) { +#if NET5_0_OR_GREATER if (Command is DbCommand typed) { await typed.DisposeAsync(); } else +#endif { Command.Dispose(); } Command = null!; } GC.SuppressFinalize(this); - } + +#if !NET5_0_OR_GREATER + return default; // not "async" in down-level #endif + } } } } diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index 797b833d2..b47fcab7d 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -511,6 +511,10 @@ public static void SetDbType(IDataParameter parameter, object value) _ => Enumerable.ToList(source), }; + /// Indicates a redundant usage of + [Obsolete("This operation is not required")] + public static List AsList(this List source) => source; + /// /// Execute parameterized SQL. /// @@ -521,7 +525,7 @@ public static void SetDbType(IDataParameter parameter, object value) /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The number of rows affected. - public static int Execute(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static int Execute(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered); return ExecuteImpl(cnn, ref command); @@ -533,7 +537,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu /// The connection to execute on. /// The command to execute on this connection. /// The number of rows affected. - public static int Execute(this IDbConnection cnn, CommandDefinition command) => ExecuteImpl(cnn, ref command); + public static int Execute(IDbConnection cnn, CommandDefinition command) => ExecuteImpl(cnn, ref command); /// /// Execute parameterized SQL that selects a single value. @@ -545,7 +549,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The first cell selected as . - public static object? ExecuteScalar(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static object? ExecuteScalar(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered); return ExecuteScalarImpl(cnn, ref command); @@ -562,7 +566,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? /// The first cell returned, as . - public static T? ExecuteScalar(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static T? ExecuteScalar(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered); return ExecuteScalarImpl(cnn, ref command); @@ -574,7 +578,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu /// The connection to execute on. /// The command to execute. /// The first cell selected as . - public static object? ExecuteScalar(this IDbConnection cnn, CommandDefinition command) => + public static object? ExecuteScalar(IDbConnection cnn, CommandDefinition command) => ExecuteScalarImpl(cnn, ref command); /// @@ -584,7 +588,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu /// The connection to execute on. /// The command to execute. /// The first cell selected as . - public static T? ExecuteScalar(this IDbConnection cnn, CommandDefinition command) => + public static T? ExecuteScalar(IDbConnection cnn, CommandDefinition command) => ExecuteScalarImpl(cnn, ref command); private static IEnumerable? GetMultiExec(object? param) @@ -598,7 +602,7 @@ public static int Execute(this IDbConnection cnn, string sql, object? param = nu ) ? (IEnumerable)param : null; } - private static int ExecuteImpl(this IDbConnection cnn, ref CommandDefinition command) + private static int ExecuteImpl(IDbConnection cnn, ref CommandDefinition command) { object? param = command.Parameters; IEnumerable? multiExec = GetMultiExec(param); @@ -681,7 +685,7 @@ private static int ExecuteImpl(this IDbConnection cnn, ref CommandDefinition com /// ]]> /// /// - public static IDataReader ExecuteReader(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static IDataReader ExecuteReader(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered); var reader = ExecuteReaderImpl(cnn, ref command, CommandBehavior.Default, out IDbCommand? dbcmd); @@ -698,7 +702,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, string sql, obje /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a /// or . /// - public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinition command) + public static IDataReader ExecuteReader(IDbConnection cnn, CommandDefinition command) { var reader = ExecuteReaderImpl(cnn, ref command, CommandBehavior.Default, out IDbCommand? dbcmd); return DbWrappedReader.Create(dbcmd, reader); @@ -715,7 +719,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// This is typically used when the results of a query are not processed by Dapper, for example, used to fill a /// or . /// - public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) + public static IDataReader ExecuteReader(IDbConnection cnn, CommandDefinition command, CommandBehavior commandBehavior) { var reader = ExecuteReaderImpl(cnn, ref command, commandBehavior, out IDbCommand? dbcmd); return DbWrappedReader.Create(dbcmd, reader); @@ -733,7 +737,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// The type of command to execute. /// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) => Query(cnn, sql, param, transaction, buffered, commandTimeout, commandType); /// @@ -747,7 +751,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// The type of command to execute. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static dynamic QueryFirst(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static dynamic QueryFirst(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryFirst(cnn, sql, param, transaction, commandTimeout, commandType); /// @@ -761,7 +765,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// The type of command to execute. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static dynamic? QueryFirstOrDefault(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static dynamic? QueryFirstOrDefault(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QueryFirstOrDefault(cnn, sql, param, transaction, commandTimeout, commandType); /// @@ -775,7 +779,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// The type of command to execute. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static dynamic QuerySingle(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static dynamic QuerySingle(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QuerySingle(cnn, sql, param, transaction, commandTimeout, commandType); /// @@ -789,7 +793,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// The type of command to execute. /// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object> [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static dynamic? QuerySingleOrDefault(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => + public static dynamic? QuerySingleOrDefault(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) => QuerySingleOrDefault(cnn, sql, param, transaction, commandTimeout, commandType); /// @@ -808,7 +812,7 @@ public static IDataReader ExecuteReader(this IDbConnection cnn, CommandDefinitio /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) + public static IEnumerable Query(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None); var data = QueryImpl(cnn, command, typeof(T)); @@ -830,7 +834,7 @@ public static IEnumerable Query(this IDbConnection cnn, string sql, object /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static T QueryFirst(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static T QueryFirst(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); return QueryRowImpl(cnn, Row.First, ref command, typeof(T)); @@ -851,7 +855,7 @@ public static T QueryFirst(this IDbConnection cnn, string sql, object? param /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static T? QueryFirstOrDefault(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static T? QueryFirstOrDefault(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); return QueryRowImpl(cnn, Row.FirstOrDefault, ref command, typeof(T)); @@ -872,7 +876,7 @@ public static T QueryFirst(this IDbConnection cnn, string sql, object? param /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static T QuerySingle(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static T QuerySingle(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); return QueryRowImpl(cnn, Row.Single, ref command, typeof(T)); @@ -893,7 +897,7 @@ public static T QuerySingle(this IDbConnection cnn, string sql, object? param /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static T? QuerySingleOrDefault(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static T? QuerySingleOrDefault(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); return QueryRowImpl(cnn, Row.SingleOrDefault, ref command, typeof(T)); @@ -916,7 +920,7 @@ public static T QuerySingle(this IDbConnection cnn, string sql, object? param /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) + public static IEnumerable Query(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None); @@ -940,7 +944,7 @@ public static IEnumerable Query(this IDbConnection cnn, Type type, strin /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static object QueryFirst(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static object QueryFirst(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); @@ -963,7 +967,7 @@ public static object QueryFirst(this IDbConnection cnn, Type type, string sql, o /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static object? QueryFirstOrDefault(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static object? QueryFirstOrDefault(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); @@ -986,7 +990,7 @@ public static object QueryFirst(this IDbConnection cnn, Type type, string sql, o /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static object QuerySingle(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static object QuerySingle(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); @@ -1009,7 +1013,7 @@ public static object QuerySingle(this IDbConnection cnn, Type type, string sql, /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static object? QuerySingleOrDefault(this IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static object? QuerySingleOrDefault(IDbConnection cnn, Type type, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { if (type is null) throw new ArgumentNullException(nameof(type)); var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.None); @@ -1026,7 +1030,7 @@ public static object QuerySingle(this IDbConnection cnn, Type type, string sql, /// A sequence of data of ; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static IEnumerable Query(this IDbConnection cnn, CommandDefinition command) + public static IEnumerable Query(IDbConnection cnn, CommandDefinition command) { var data = QueryImpl(cnn, command, typeof(T)); return command.Buffered ? data.ToList() : data; @@ -1042,7 +1046,7 @@ public static IEnumerable Query(this IDbConnection cnn, CommandDefinition /// A single instance or null of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static T QueryFirst(this IDbConnection cnn, CommandDefinition command) => + public static T QueryFirst(IDbConnection cnn, CommandDefinition command) => QueryRowImpl(cnn, Row.First, ref command, typeof(T)); /// @@ -1055,7 +1059,7 @@ public static IEnumerable Query(this IDbConnection cnn, CommandDefinition /// A single or null instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static T? QueryFirstOrDefault(this IDbConnection cnn, CommandDefinition command) => + public static T? QueryFirstOrDefault(IDbConnection cnn, CommandDefinition command) => QueryRowImpl(cnn, Row.FirstOrDefault, ref command, typeof(T)); /// @@ -1068,7 +1072,7 @@ public static IEnumerable Query(this IDbConnection cnn, CommandDefinition /// A single instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static T QuerySingle(this IDbConnection cnn, CommandDefinition command) => + public static T QuerySingle(IDbConnection cnn, CommandDefinition command) => QueryRowImpl(cnn, Row.Single, ref command, typeof(T)); /// @@ -1081,7 +1085,7 @@ public static IEnumerable Query(this IDbConnection cnn, CommandDefinition /// A single instance of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is /// created per row, and a direct column-name===member-name mapping is assumed (case insensitive). /// - public static T? QuerySingleOrDefault(this IDbConnection cnn, CommandDefinition command) => + public static T? QuerySingleOrDefault(IDbConnection cnn, CommandDefinition command) => QueryRowImpl(cnn, Row.SingleOrDefault, ref command, typeof(T)); /// @@ -1093,7 +1097,7 @@ public static IEnumerable Query(this IDbConnection cnn, CommandDefinition /// The transaction to use for this query. /// Number of seconds before command execution timeout. /// Is it a stored proc or a batch? - public static GridReader QueryMultiple(this IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) + public static GridReader QueryMultiple(IDbConnection cnn, string sql, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, CommandFlags.Buffered); return QueryMultipleImpl(cnn, ref command); @@ -1104,10 +1108,10 @@ public static GridReader QueryMultiple(this IDbConnection cnn, string sql, objec /// /// The connection to query on. /// The command to execute for this query. - public static GridReader QueryMultiple(this IDbConnection cnn, CommandDefinition command) => + public static GridReader QueryMultiple(IDbConnection cnn, CommandDefinition command) => QueryMultipleImpl(cnn, ref command); - private static GridReader QueryMultipleImpl(this IDbConnection cnn, ref CommandDefinition command) + private static GridReader QueryMultipleImpl(IDbConnection cnn, ref CommandDefinition command) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, typeof(GridReader), param?.GetType()); @@ -1166,7 +1170,7 @@ private static DbDataReader ExecuteReaderWithFlagsFallback(IDbCommand cmd, bool } } - private static IEnumerable QueryImpl(this IDbConnection cnn, CommandDefinition command, Type effectiveType) + private static IEnumerable QueryImpl(IDbConnection cnn, CommandDefinition command, Type effectiveType) { object? param = command.Parameters; var identity = new Identity(command.CommandText, command.CommandTypeDirect, cnn, effectiveType, param?.GetType()); @@ -1393,7 +1397,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1415,7 +1419,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1438,7 +1442,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1462,7 +1466,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1487,7 +1491,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1513,7 +1517,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => + public static IEnumerable Query(IDbConnection cnn, string sql, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) => MultiMap(cnn, sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType); /// @@ -1533,7 +1537,7 @@ private static T GetValue(DbDataReader reader, Type effectiveType, object? va /// Is it a stored proc or a batch? /// An enumerable of . [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Grandfathered")] - public static IEnumerable Query(this IDbConnection cnn, string sql, Type[] types, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) + public static IEnumerable Query(IDbConnection cnn, string sql, Type[] types, Func map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) { var command = new CommandDefinition(sql, param, transaction, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None); var results = MultiMapImpl(cnn, command, types, map, splitOn, null, null, true); @@ -1548,7 +1552,7 @@ public static IEnumerable Query(this IDbConnection cnn, string return buffered ? results.ToList() : results; } - private static IEnumerable MultiMapImpl(this IDbConnection? cnn, CommandDefinition command, Delegate map, string splitOn, DbDataReader? reader, Identity? identity, bool finalize) + private static IEnumerable MultiMapImpl(IDbConnection? cnn, CommandDefinition command, Delegate map, string splitOn, DbDataReader? reader, Identity? identity, bool finalize) { object? param = command.Parameters; identity ??= new Identity(command.CommandText, command.CommandTypeDirect, cnn!, typeof(TFirst), param?.GetType()); @@ -1614,7 +1618,7 @@ private static CommandBehavior GetBehavior(bool close, CommandBehavior @default) return (close ? (@default | CommandBehavior.CloseConnection) : @default) & Settings.AllowedCommandBehaviors; } - private static IEnumerable MultiMapImpl(this IDbConnection? cnn, CommandDefinition command, Type[] types, Func map, string splitOn, DbDataReader? reader, Identity? identity, bool finalize) + private static IEnumerable MultiMapImpl(IDbConnection? cnn, CommandDefinition command, Type[] types, Func map, string splitOn, DbDataReader? reader, Identity? identity, bool finalize) { if (types.Length < 1) { diff --git a/Directory.Build.props b/Directory.Build.props index d858cf494..1d2c03e91 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,10 +21,15 @@ false true true - 9.0 + preview false true readme.md + true + latest-Recommended + preview + ($Features);strict + true diff --git a/Directory.Packages.props b/Directory.Packages.props index 06e68e627..a126f8ed4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,8 +1,8 @@ - + @@ -17,6 +17,7 @@ + diff --git a/benchmarks/Dapper.Tests.Performance/Benchmarks.Dapper.cs b/benchmarks/Dapper.Tests.Performance/Benchmarks.Dapper.cs index 40f3eb8d7..5931e0cc1 100644 --- a/benchmarks/Dapper.Tests.Performance/Benchmarks.Dapper.cs +++ b/benchmarks/Dapper.Tests.Performance/Benchmarks.Dapper.cs @@ -18,28 +18,28 @@ public void Setup() public Post QueryBuffered() { Step(); - return _connection.Query("select * from Posts where Id = @Id", new { Id = i }, buffered: true).First(); + return _connection.Query("select * from Posts where Id = @Id", new { Id = i }).First(); } [Benchmark(Description = "Query (buffered)")] public dynamic QueryBufferedDynamic() { Step(); - return _connection.Query("select * from Posts where Id = @Id", new { Id = i }, buffered: true).First(); + return _connection.Query("select * from Posts where Id = @Id", new { Id = i }).First(); } [Benchmark(Description = "Query (unbuffered)")] public Post QueryUnbuffered() { Step(); - return _connection.Query("select * from Posts where Id = @Id", new { Id = i }, buffered: false).First(); + return _connection.QueryUnbuffered("select * from Posts where Id = @Id", new { Id = i }).First(); } [Benchmark(Description = "Query (unbuffered)")] public dynamic QueryUnbufferedDynamic() { Step(); - return _connection.Query("select * from Posts where Id = @Id", new { Id = i }, buffered: false).First(); + return _connection.QueryUnbuffered("select * from Posts where Id = @Id", new { Id = i }).First(); } [Benchmark(Description = "QueryFirstOrDefault")] diff --git a/benchmarks/Dapper.Tests.Performance/DapperCacheImpact.cs b/benchmarks/Dapper.Tests.Performance/DapperCacheImpact.cs index 9e17249bf..903aaae44 100644 --- a/benchmarks/Dapper.Tests.Performance/DapperCacheImpact.cs +++ b/benchmarks/Dapper.Tests.Performance/DapperCacheImpact.cs @@ -20,20 +20,20 @@ public class Foo // note: custom BDN setup means [Params] is awkward; unroll manually instead [Benchmark] - public void ExecuteNoParameters_Cache() => _connection.Execute(new CommandDefinition("select '42' as Id, 'abc' as Name", flags: CommandFlags.None)); + public void ExecuteNoParameters_Cache() => _connection.Execute("select '42' as Id, 'abc' as Name", flags: CommandFlags.None); [Benchmark] - public void ExecuteParameters_Cache() => _connection.Execute(new CommandDefinition("select @id as Id, @name as Name", args, flags: CommandFlags.None)); + public void ExecuteParameters_Cache() => _connection.Execute("select @id as Id, @name as Name", args, flags: CommandFlags.None); [Benchmark] - public void QueryFirstNoParameters_Cache() => _connection.QueryFirst(new CommandDefinition("select '42' as Id, 'abc' as Name", flags: CommandFlags.None)); + public void QueryFirstNoParameters_Cache() => _connection.QueryFirst("select '42' as Id, 'abc' as Name", flags: CommandFlags.None); [Benchmark] - public void QueryFirstParameters_Cache() => _connection.QueryFirst(new CommandDefinition("select @id as Id, @name as Name", args, flags: CommandFlags.None)); + public void QueryFirstParameters_Cache() => _connection.QueryFirst("select @id as Id, @name as Name", args, flags: CommandFlags.None); [Benchmark] - public void ExecuteNoParameters_NoCache() => _connection.Execute(new CommandDefinition("select '42' as Id, 'abc' as Name", flags: CommandFlags.NoCache)); + public void ExecuteNoParameters_NoCache() => _connection.Execute("select '42' as Id, 'abc' as Name", flags: CommandFlags.NoCache); [Benchmark] - public void ExecuteParameters_NoCache() => _connection.Execute(new CommandDefinition("select @id as Id, @name as Name", args, flags: CommandFlags.NoCache)); + public void ExecuteParameters_NoCache() => _connection.Execute("select @id as Id, @name as Name", args, flags: CommandFlags.NoCache); [Benchmark] - public void QueryFirstNoParameters_NoCache() => _connection.QueryFirst(new CommandDefinition("select '42' as Id, 'abc' as Name", flags: CommandFlags.NoCache)); + public void QueryFirstNoParameters_NoCache() => _connection.QueryFirst("select '42' as Id, 'abc' as Name", flags: CommandFlags.NoCache); [Benchmark] - public void QueryFirstParameters_NoCache() => _connection.QueryFirst(new CommandDefinition("select @id as Id, @name as Name", args, flags: CommandFlags.NoCache)); + public void QueryFirstParameters_NoCache() => _connection.QueryFirst("select @id as Id, @name as Name", args, flags: CommandFlags.NoCache); } } diff --git a/tests/Dapper.Tests/AsyncTests.cs b/tests/Dapper.Tests/AsyncTests.cs index 7a9abf2d1..7ca1813c6 100644 --- a/tests/Dapper.Tests/AsyncTests.cs +++ b/tests/Dapper.Tests/AsyncTests.cs @@ -432,7 +432,7 @@ public async Task LiteralReplacementClosed() await LiteralReplacement(conn).ConfigureAwait(false); } - private static async Task LiteralReplacement(IDbConnection conn) + private static async Task LiteralReplacement(DbConnection conn) { try { @@ -462,7 +462,7 @@ public async Task LiteralReplacementDynamicClosed() await LiteralReplacementDynamic(conn).ConfigureAwait(false); } - private static async Task LiteralReplacementDynamic(IDbConnection conn) + private static async Task LiteralReplacementDynamic(DbConnection conn) { var args = new DynamicParameters(); args.Add("id", 123); diff --git a/tests/Dapper.Tests/MiscTests.cs b/tests/Dapper.Tests/MiscTests.cs index 24f7bf2bd..124555321 100644 --- a/tests/Dapper.Tests/MiscTests.cs +++ b/tests/Dapper.Tests/MiscTests.cs @@ -493,14 +493,14 @@ public void TestExpandWithNullableFields() [Fact] public void TestEnumeration() { - var en = connection.Query("select 1 as one union all select 2 as one", buffered: false); + var en = connection.QueryUnbuffered("select 1 as one union all select 2 as one"); var i = en.GetEnumerator(); i.MoveNext(); bool gotException = false; try { - var x = connection.Query("select 1 as one", buffered: false).First(); + var x = connection.QueryUnbuffered("select 1 as one").First(); } catch (Exception) { @@ -512,7 +512,7 @@ public void TestEnumeration() } // should not exception, since enumerated - en = connection.Query("select 1 as one", buffered: false); + en = connection.QueryUnbuffered("select 1 as one"); Assert.True(gotException); } @@ -520,14 +520,14 @@ public void TestEnumeration() [Fact] public void TestEnumerationDynamic() { - var en = connection.Query("select 1 as one union all select 2 as one", buffered: false); + var en = connection.QueryUnbuffered("select 1 as one union all select 2 as one"); var i = en.GetEnumerator(); i.MoveNext(); bool gotException = false; try { - var x = connection.Query("select 1 as one", buffered: false).First(); + var x = connection.QueryUnbuffered("select 1 as one").First(); } catch (Exception) { @@ -539,7 +539,7 @@ public void TestEnumerationDynamic() } // should not exception, since enumertated - en = connection.Query("select 1 as one", buffered: false); + en = connection.QueryUnbuffered("select 1 as one"); Assert.True(gotException); } @@ -1178,7 +1178,7 @@ public void QueryComplexWithoutQuery() public void Issue263_Timeout() { var watch = Stopwatch.StartNew(); - var i = connection.Query("waitfor delay '00:01:00'; select 42;", commandTimeout: 300, buffered: false).Single(); + var i = connection.QueryUnbuffered("waitfor delay '00:01:00'; select 42;", commandTimeout: 300).Single(); watch.Stop(); Assert.Equal(42, i); var minutes = watch.ElapsedMilliseconds / 1000 / 60; diff --git a/tests/Dapper.Tests/Providers/OLDEBTests.cs b/tests/Dapper.Tests/Providers/OLDEBTests.cs index 1fa8da3b9..c98a411fd 100644 --- a/tests/Dapper.Tests/Providers/OLDEBTests.cs +++ b/tests/Dapper.Tests/Providers/OLDEBTests.cs @@ -80,7 +80,7 @@ public void Issue569_SO38527197_PseudoPositionalParameters_In_And_Other_Conditio const int score = 2; int[] ids = { 1, 2, 5, 7 }; - var list = connection.Query(sql, new { ids, score }).AsList(); + var list = connection.Query(sql, new { ids, score }); list.Sort(); Assert.Equal("1,2,5", string.Join(",", list)); } @@ -90,7 +90,7 @@ public void Issue569_SO38527197_PseudoPositionalParameters_In() { using var connection = GetOleDbConnection(); int[] ids = { 1, 2, 5, 7 }; - var list = connection.Query("select * from string_split('1,2,3,4,5',',') where value in ?ids?", new { ids }).AsList(); + var list = connection.Query("select * from string_split('1,2,3,4,5',',') where value in ?ids?", new { ids }); list.Sort(); Assert.Equal("1,2,5", string.Join(",", list)); } diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index ca3ad8b24..5a43f6982 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -20,7 +20,7 @@ - +