Why this matters
Reduces round-trips and improves query performance.
Prefer JOINs/eager loading over per-row queries to avoid N+1 patterns.
Reduces round-trips and improves query performance.
Side-by-side examples engineers can pattern-match during review.
var orders = await ctx.Orders.ToListAsync();
foreach (var o in orders) o.Customer = await ctx.Customers.FindAsync(o.CustomerId);var orders = await ctx.Orders.Include(o => o.Customer).ToListAsync();foreach rows => FindAsync()Include(x => x.Relation)From the same buckets as this rule.
Review SQL/database migrations for operations that can lock large tables or cause downtime. Examples: creating indexes without CONCURRENTLY (Postgres), ALTER COLUMN TYPE on big tables, adding NOT NULL without backfill, long-running updates without batching. Require an online migration strategy (CONCURRENTLY, backfill in batches, dual-write/expand-contract) and a rollback plan.