c# - Entity framework - queue async context -


    task task1 = servicea.dosomething();     task task2 = serviceb.dosomethingelse();      await task.whenall(task1, task2); 

services have no idea operating on database, if both tasks end querying 1 database there concurrency exception.

as described in does entity framework support parallel async queries? ef not support multiple async queries.

is there pattern or way queue such queries/commands , execute them 1 after (but still speed execuition if hitting separate database)?

maybe better solution change dbcontext per-request transient , new dbcontext separate connection each query? performance implications of this? first see separate transaction each dbcontext , commiting them instead of single transaction.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -