-
Notifications
You must be signed in to change notification settings - Fork 595
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
IEnumerable for QueryAsync #600
Comments
@shaunbowe, the reason for this is history. At the time I implemented the Async methods the I'll take your word for the immediate execution of the query, as I haven't tested this. I will say, however, the point of the Query/QueryAsync APIs is to stream the results from the DB as one iterates through the result set. On this point, the two APIs are the same. It might be time to add support for |
I kind of figured that was the reason. If it was my project I would add it as QueryEnumerableAsync in v6 and change it to QueryAsync in v7. I'd be more than happy to submit a PR or help on this if we can agree on a strategy. Thanks for the response. |
The problem with supporting this in v6 is that it targets
and none of those support |
@pleb Do you think it is possible to write a wrapper on top of existing petapoco async api to make IAsyncEnumerable work? |
We don't necessarily need IAsyncEnumerable. It seems Dapper has not yet converted to IAsyncEnumerable yet either. They do however support IEnumerable. I am willing to take a shot at converting this/adding this feature but would like some guidance about what version to create this in and how to proceed. |
@shaunbowe the Dapper one is a workaround, and I have my doubts as to whether it is a true async version. I created this for you (I was using net5 and the lastest c# version)
and it seems to work
the magic part
|
@pleb Thank you very much. I will check it out. I would like to buy a beer. I don't see anyways to do that. Do you have patreon link or something similar? |
Thanks, @iraSenthil, but there's really no need. Happy to help |
The behavior for Query and QueryAsync are different. Query returns an IEnumerable and does not execute the query until the results are enumerated. QueryAsync returns IAsyncReader and the query is executed immediately.
Is it possible to return IEnumerable instead of IAsyncReader for the QueryAsync method?
The text was updated successfully, but these errors were encountered: