Skip to content

Add CancellationToken optional parameter to all Async methods #1938

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

Open
mcenzato opened this issue Jul 18, 2023 · 2 comments
Open

Add CancellationToken optional parameter to all Async methods #1938

mcenzato opened this issue Jul 18, 2023 · 2 comments

Comments

@mcenzato
Copy link

I saw that a lot of Dapper async methods (eg. QueryAsync) miss the CancellationToken parameter.

@Rendojack
Copy link

You can workaround this by passing CommandDefinition with assigned CancellationToken in most of the simple queries, except more complicates ones, like with multi-mapping.

itcotta added a commit to itcotta/Dapper that referenced this issue Dec 30, 2024
This change introduces a CancellationToken parameter to the QueryAsync method, enabling support for cooperative cancellation of asynchronous database queries. The modification ensures better resilience and control over long-running or potentially cancelable operations.

This fixes issues DapperLib#2125 and DapperLib#1938.
@digibum
Copy link

digibum commented Apr 1, 2025

A friendly reminder for this. Especially for multi-mapping and a simpler implementation without the need for CommandDefinition. Just add an optional parameter to the basic Query methods. Thank you!

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

No branches or pull requests

3 participants