Suppose I have constructed an argument using conditional logic in a number of phases.
example, we'll use
I want to call in order to acquire a page of data and a count of all the entries.
. Because they both attempt to conduct a query on the same database, a race situation results if I try to call them back-to-back.
both at once. This is prohibited:
"A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe."
I don't want to begin the second before even "waiting" for the first. I want to send both inquiries out as soon as I can. The only way to do this is to run them from separate DbContexts. It seems absurd that I could have to construct the full query (or two, or three) side by side by beginning with various examples of
. Is it possible to replicate or change an
(maybe not that interface, but its underlying implementation) so that I may have a single copy that functions on
A further one that will function on
"B", such that both queries may run concurrently? Simply put, I don't want to have to recreate the query X times from start in order to execute it on X contexts.