Reputation: 21206
I am using Web API. I know I have to use a full async stack to get its benefits. That means the API Controller are async calls to my service and my service does async calls to my dataprovider which do async datareader for example.
I guess when I start with using async in the controller I also should do an OpenAsync() on a database connection and use only the async Non-/Query calls.
Is this true?
When I have 3 NonQueries (A) doing stuff on Table 1,2,3. When this task is finished there MUST follow 4 NonQueries (B) doing stuff on Table 1,2,3.
Can I make use of the ExecuteNonQueryAsync method for A OR do I have to fear that B will be faster executed than A which might cause inconsistent data in my case?
Upvotes: 1
Views: 148
Reputation: 116518
Upvotes: 3
Reputation: 2018
1) False, not necessarily 2) Doesn't apply then.
By marking your actions async the apppool thread will be released for new requests and the current request is handled by a background thread.
Upvotes: 1