-
Notifications
You must be signed in to change notification settings - Fork 293
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
Convert ExecuteNonQueryAsync to use async context object #1692
Conversation
829b9cf
to
176ecaf
Compare
Codecov ReportBase: 71.60% // Head: 71.00% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1692 +/- ##
==========================================
- Coverage 71.60% 71.00% -0.61%
==========================================
Files 293 293
Lines 61381 64971 +3590
==========================================
+ Hits 43953 46133 +2180
- Misses 17428 18838 +1410
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/AAsyncCallContext.cs
Outdated
Show resolved
Hide resolved
@Wraith2 Looks like there's a merge conflict. Let us know if you would like us to resolve it for you. |
I took care of it. It was a small change from #1781. |
That'll teach me to use the GitHub conflict UI. I broke it. I'm looking at it. |
2b834c5
to
2a3996a
Compare
Rebased, checked it still makes sense and addressed the feedback above. |
fixes #1682
This addresses the incorrect handling of cancellation token registrations in
SqlCommand
methodsExecuteNonQuery
andExecuteReader
, I didn't changeExecuteScalar
because it should be done in a separate PR and it's justExecuteReader
wearing a fake nose a glasses, people should useExexuteReader
Background information: There are a number of async api calls on
SqlDataReader
which have been changed to avoid the use of language provided lambda closures and instead use explicit context objects. This process makes the code more complicated because it splits apart the code into multiple functions so that instance delegate allocations can be avoided. This pattern is no longer needed if we use language provided static lambdas and the code can be much cleaner and better contained. This PR converts the ExecuteNonQuery function to use this explicity context pattern and uses static lambdas to doi t.This PR also changes all existing context objects to use an explicit type for the IDispoable so that we can avoid boxing the disposable. This change forces any existing context types which were declared like this:
AAsyncContext<TOwner,TResult>
to be split apart into two types,AAsyncContext<TOwner,TResult,TDisposable>
which has a strong disposable type and is used at call sites that know what the disposable is, mostly setup locations.AAsyncBaseContext<TOwner,TResult>
which is used in the async functions that don't need to know what the type of the disposable is so we can avoid duplicating functions likeInvokeAsync
The specific changes to fix the issue reported are
InternalExecuteNonQueryAsync
to use an explicity context object/cc @olegkv