N+1 and loading traps
Find database calls inside loops, missing includes, deep eager-loading chains, cartesian explosion risks, and untagged complex queries.
EF Core LINQ analyzer
Catch costly query shapes at compile time: N+1 loops, premature materialization, raw SQL risks, sync-over-async calls, tracking mistakes, and missing includes.
What it catches
LinqContraband turns EF Core review knowledge into analyzer diagnostics that show up in the IDE and CI while the code is still cheap to change.
Find database calls inside loops, missing includes, deep eager-loading chains, cartesian explosion risks, and untagged complex queries.
Catch local methods, string conversions, untranslatable overloads, nondeterministic pagination, and query shapes EF Core cannot safely move to SQL.
Flag interpolated raw SQL, constructed SQL strings, query-filter bypasses, mixed tracking modes, and silent no-tracking writes.
Install
LinqContraband runs during compilation in Visual Studio, Rider, VS Code, and CI. Your application does not load it at runtime.
dotnet add package LinqContraband
Official reference
The package is distributed through NuGet and the official GitHub repository. LinqContraband is not shipped as a standalone ZIP installer or executable.
Browse every diagnostic by EF Core domain, severity, and fix availability.
Map the rule families for query shape, loading, async execution, tracking, bulk operations, and raw SQL safety.
Read the overview for teams comparing compile-time query analysis options.
Review async EF Core paths for sync-over-async calls, missing cancellation tokens, async streams, and SaveChangesAsync loops.
Review missing tokens for ToListAsync, FirstOrDefaultAsync, SaveChangesAsync, and other EF Core async calls.
Review translation boundaries for local methods in IQueryable, early AsEnumerable, StringComparison overloads, and GroupBy projections.
Use the review checklist for N+1 risks, projection, tracking, raw SQL, and CI severity policy.
Review scoped lifetimes, singleton captures, cross-thread usage, disposed queries, and tracking-mode surprises.
Review early ToList, AsEnumerable boundaries, unbounded materialization, and projection waste.
Review Select shapes for whole-entity loads, scalar projection opportunities, nested ToList, and identity Select calls.
Review deterministic paging for Skip, Take, Last, ElementAt, Chunk, and misplaced OrderBy calls.
Tune loading rules for missing includes, cartesian explosion, deep eager-loading chains, and query tags.
Review tracking rules for read-only queries, no-tracking writes, mixed modes, and silent SaveChanges failures.
Review bulk writes for set-based updates, ExecuteDelete replacements, and missing Where filters.
Review repeated writes for per-item commits, N+1 writes, async saves, and batching policy.
See the N+1 guide for loop execution, missing includes, eager loading trade-offs, and telemetry tags.
Review the SQL guide for interpolated raw SQL, constructed SQL strings, and query-filter bypasses.
Set up the CI guide for pull-request checks, severity policy, and build-breaking EF Core diagnostics.
Verify official links before installing or linking to the project.
Visit George Wall's site for the author profile and other maintained projects.
Copy safe snippets for articles, newsletters, tool lists, docs, and talks.