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
Post a Comment