dotnet / dotnet/EntityFramework.Docs
How do I async foreach??
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
I'm ashamed to say that I had to look this up. (+1 for https://github.com/dotnet/efcore/issues/28103 BTW) I'm even more ashamed at how hard it was to find the answer.
```cs
var blogs = context.Blogs.Where(b => b.Rating > 3);
await foreach (var blog in blogs.AsAsyncEnumerable())
{
// ...
}
```
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: b68ae31d-b942-507a-2b9f-c8f7632ff283
* Version Independent ID: 0574f1d2-3620-c6b6-94b8-99a455a67a5a
* Content: [Asynchronous Programming - EF Core](https://learn.microsoft.com/en-us/ef/core/miscellaneous/async)
* Content Source: [entity-framework/core/miscellaneous/async.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/miscellaneous/async.md)
* Product: **entity-framework**
* Technology: **entity-framework-core**
* GitHub Login: @roji
* Microsoft Alias: **avickers**
Contributor guide
Assessment
This issue has not been assessed yet.