-
-
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 missing buffered parameter #1239
Comments
Well that's odd. Is there an overload that takes the struct? Maybe that has
it?
But: when async iterators lands in c# vNext, we'll need to revisit the
non-buffered query-async *anyway*, as it is only pseudo-async at the moment
(by necessity).
…On Sat, 13 Apr 2019, 12:31 vitidev, ***@***.***> wrote:
I can
db.Query<Person>(sql, parameters, buffered: false)
But I can't
db.QueryAsync<Person>(sql, parameters, buffered: false)
At the same time, the multimap overload of QueryAsync has parameter
"buffered"
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,
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1239>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABDsOREEPN9TeUGJnFGuFIAmG79vRKlks5vgcATgaJpZM4ct_z0>
.
|
@mgravell But it was expected that synchronous and asynchronous versions will have "mirror" signatures. Sometimes you have to convert Query into QueryAsyncand it's very nice when it's enough to add Async(+await) and that is all
That all the same it is good, it is possible not to hold a current thread waiting for the response from a database
Async enumerators are good, but a little incomprehensible why you can not do without them like
Or is it already there and I do not read the documentation well? |
You absolutely *can* do that as long as you're happy for the consuming code
to do that work but a execute-reader and getting the per-T materializer
separately. The point here is that until C# vNext, neither "foreach" nor
"yield return" support this scenario, so you can't *just* return a
sequence. That's what vNext gives us: "await foreach".
…On Sat, 13 Apr 2019, 14:25 vitidev, ***@***.***> wrote:
@mgravell <https://github.com/mgravell>
Yes. I found
QueryAsync<T>(this IDbConnection cnn, CommandDefinition command)
But it was expected that synchronous and asynchronous versions will have
"mirror" signatures. Sometimes you have to convert Query into QueryAsyncand
it's very nice when it's enough to add Async(+await) and that is all
as it is only pseudo-async at the moment
That all the same it is good, it is possible not to hold a current thread
waiting for the response from a database
when async iterators lands in c# vNext
Async enumerators are good, but a little incomprehensible why you can not
do without them like
var reader = await db.ExecuteAsyncReaderAsync(); //
while (await reader.ReadAsync())
{
var value = reader.GetChar(0);
}
var reader = await db.QueryReaderAsync<Person>();
while (await reader.MoveNext())
{
var value = reader.Current;
}
Or is it already there and I do not read the documentation well?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1239 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABDsFsWCmXZZlEpxtFsoLU-whZ7wIXRks5vgdq7gaJpZM4ct_z0>
.
|
@mgravell await foreach is out there now. Any plans to support this now? |
Plans, yes. What I need is time. Working through some redis and protobuf bits, then I should be able to take a look at Dapper |
@mgravell, Dapper has been such a help, I'd like to return the favor. I think I can contribute if someone points me in the right direction. Meanwhile, I got this from an SO post. Do you think it is a reliable workaround until we get an API for it?
|
add some while (await reader.ReadAsync()) {
yield return rowParser(reader);
}
while (await reader.NextResultAsync()) {} but: up to you |
Did this ever get implemented in dapper directly? Thanks, |
any news regarding this? |
this feature now essentially provided via #1912 |
I can
db.Query<Person>(sql, parameters, buffered: false)
But I can't
db.QueryAsync<Person>(sql, parameters, buffered: false)
At the same time, the multimap overload of QueryAsync has parameter "buffered"
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,
The text was updated successfully, but these errors were encountered: