-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
QueryAsync with custom mapping AND CancellationToken #2125
Comments
Maybe relevant? |
no because that one doesnt do multi mapping |
I think we use multi mapping in a similar way. Let me see
But I might be missing something. |
this is for a static number of objects in the result |
It could be helpful if you point us to the signature which is missing the |
public static Task<IEnumerable<TReturn>> QueryAsync<TReturn>(this IDbConnection cnn, string sql, Type[] types, Func<object[], TReturn> map, object? param = null, IDbTransaction? transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null) this one i want this to be public because ^^ just wraps all the parameters into a command definition and calls this: private static async Task<IEnumerable<TReturn>> MultiMapAsync<TReturn>(this IDbConnection cnn, CommandDefinition command, Type[] types, Func<object[], TReturn> map, string splitOn) |
Hi, I've ran into the same use case. Is there really no way of passing a CancellationToken when using custom mapping? |
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.
I want to use QueryAsync with multiple types mapped onto a single return type WITH a cancellation token but none of the QueryAsync functions allow for that.
My current solution is to use the private
MultiMapAsync
method but this is not ideal and I don't know what the right solution to this would be but I'd like to talk about it and if you're down I can make a pull request.The text was updated successfully, but these errors were encountered: