Querying a databaseintermediate
IQueryable lets you build a query in pieces and send one efficient SQL statement — the classic mistake is fetching every row into memory and filtering there.
Somebody read that AsNoTracking is faster and put it everywhere, including on the method that saves. Decide per path: reads do not track, writes must, and the report that reaches the same row twice needs the identity map without the snapshots.
Each path chooses tracking for a stated reason, and the update actually persists.
Published in full, before you start — every point is one of these and there is nothing else.
IQueryable lets you build a query in pieces and send one efficient SQL statement — the classic mistake is fetching every row into memory and filtering there.
Creating a record means deciding its id, checking it before it lands, and never modifying the list you were handed — because a half-written row is harder to find and fix than a rejected request.