Skip to content

Early materialization (ARCH205)

Key dotnet.ef.early-materialization · Severity warning · Category ef

Materializing the query early forces subsequent filters and sorts to run client-side over the whole data set.

var result = (await _db.Orders.ToListAsync())
.Where(o => o.Total > 100)
.OrderBy(o => o.Date)
.ToList();
var result = await _db.Orders
.Where(o => o.Total > 100)
.OrderBy(o => o.Date)
.ToListAsync();

Apply filters and ordering before ToListAsync().