Are there any differences in behavior or performance between AsEnumerable
, AsAsyncEnumerable
and simple iteration over IQueryable
in EF Core?
// Using .AsEnumerable();
var blogs = context.Posts.Where(p => p.Title.StartsWith("A").AsEnumerable();
foreach (var blog in blogs)
{
// ...
}
// Just iterating over IQueryable;
var blogs = context.Posts.Where(p => p.Title.StartsWith("A");
foreach (var blog in blogs)
{
// ...
}
// Using .AsAsyncEnumerable();
var blogs = context.Posts.Where(p => p.Title.StartsWith("A").AsAsyncEnumerable();
await foreach (var blog in blogs)
{
// ...
}