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

Missing signature on QueryAsync method #2094

Open
FabienEstier opened this issue Jun 13, 2024 · 3 comments
Open

Missing signature on QueryAsync method #2094

FabienEstier opened this issue Jun 13, 2024 · 3 comments

Comments

@FabienEstier
Copy link

I'm using this method signature for QueryAsync:
public static Task QueryAsync(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)

I need to pass a Cancellation token but there is no available signature with Type[] types, Func<object[], TReturn> map and string splitOn parameters. I tried to used the signature with a CommandDefinition object because it contains a property named CancellationToken but this signature doesn't contain types, map and splitOn too.
Is it possible to add it in a future release ?

@konstantinLyang
Copy link

konstantinLyang commented Jun 19, 2024

I searched the entire Internet and found no information about this.. What should I do with complex queries? Does it turn out that developers using dapper have to turn a blind eye to security and speed? If the user clicks 10,000 times in a row on the button to receive data from the api and it is the QueryAsync method that is complex and WITHOUT a cancellation token, what happens then?

@richardcox13
Copy link

Use a QueryAsync definition that takes a CommandDefinition, pass your CancellationToken to the CommandDefinition constructor.

@konstantinLyang
Copy link

Use a QueryAsync definition that takes a CommandDefinition, pass your CancellationToken to the CommandDefinition constructor.

for simple tasks. If we need insert mapper, types, split on parameters???

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