تخطَّ إلى المحتوى

As no tracking (ARCH201)

هذا المحتوى غير متوفر بلغتك بعد.

Key dotnet.ef.as-no-tracking · Severity warning · Category ef

For read-only queries EF Core still tracks entities for change detection, wasting memory and CPU.

var users = await _db.Users
.Where(u => u.IsActive)
.ToListAsync();
return users;
var users = await _db.Users
.AsNoTracking()
.Where(u => u.IsActive)
.ToListAsync();
return users;

Add AsNoTracking() to queries whose results you will not modify.