Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CancellationToken support #13

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Conversation

terryaney
Copy link
Contributor

Added CancellationToken support. I tagged you in a couple of tweets to Marc Gravell that you probably saw. From what I understand, adding the optional CancellationToken parameter shouldn't break any existing compatibility, but maybe you know as well. Maintaining open source compatibility is a new realm for me :)

Additionally, I submitted a pr to Dapper to enable support on the following overload (currently, I just disregard the CancellationToken):

        public static Task<IEnumerable<TReturn>> QueryAsync<TReturn>(this IDapperSqlCommand command, Type[] types, Func<object[], TReturn> map, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null, CancellationToken cancellationToken = default)
        {
            return command.DbConnection.QueryAsync<TReturn>(sql: command.Sql, param: ParametersDictionary.LoadFrom(command), transaction: transaction, commandTimeout: commandTimeout, commandType: commandType, buffered: buffered, types: types, map: map, splitOn: splitOn);
            // return command.DbConnection.QueryAsync<TReturn>(command: new CommandDefinition(commandText: command.Sql, parameters: ParametersDictionary.LoadFrom(command), transaction: transaction, commandTimeout: commandTimeout, commandType: commandType, flags: buffered ? CommandFlags.Buffered : CommandFlags.None, cancellationToken: cancellationToken), types: types, map: map, splitOn: splitOn);
        }

@Drizin Drizin merged commit 67f3c49 into Drizin:main Mar 11, 2024
@Drizin
Copy link
Owner

Drizin commented Mar 11, 2024

Looks good, thanks! Republished as 2.2.0

@terryaney terryaney deleted the feature/cancellationToken branch March 12, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants