Task.WhenAll

 

var parallelSupplierTask = dbParallel1.Supplier.Where(x => x.Name.Contains("7")).OrderByDescending(x => x.Name).ToListAsync(); var parallelCustomerTask = dbParallel2.Customer.Where(x => x.Name.Contains("7")).OrderByDescending(x => x.Name).ToListAsync();

await Task.WhenAll(parallelSupplierTask, parallelCustomerTask);

https://juldhais.net/super-fast-query-in-entity-framework-6d20cd5358e2

https://stackoverflow.com/questions/41749896/ef-6-how-to-correctly-perform-parallel-queries


Also use AsNoTracking when using EF


Excellent Q & A.  See all the answers.

https://stackoverflow.com/questions/34375696/executing-tasks-in-parallel


The 109 answer is a really nice example:

https://stackoverflow.com/questions/12343081/run-two-async-tasks-in-parallel-and-collect-results-in-net-4-5


Comments

Popular posts from this blog

Upgrading to .NET8 from desktop versions 4.8.X

JSON Web Tokens

GHL > Set website so shorter URL address