Entity Framework Core 10.0
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
2prompts
- C# 14106 lines · 4.4K tokens
- Entity Framework Core 10.060 lines · 2.3K tokens
Total166 lines · 6.6K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 257
- 295
- 319
- 323
- 327
- 338
- 362
- 367
- 378
- 426
- 488
- 502
- 532
- 611
- 639
- 674
- 759
- 770
- 772
- 775
- 798
- 862
- 915
- 916
- 918
- 923
- 1333
- 1395
Prompt Preview
Apply the C# 14 baseline first. These rules cover Entity Framework Core 10.0 queries, raw SQL, change tracking, authorization, tenancy, transactions, concurrency, connections, migrations, and diagnostics.
Queries and SQL
- Prefer LINQ and the parameterizing
FromSql,FromSqlInterpolated,SqlQuery, and interpolatedExecuteSql;FromSqlRaw,SqlQueryRaw, andExecuteSqlRawneed separately controlled SQL text and parameters. - Never splice a request value into raw SQL, including an interpolated string passed to a
*RawAPI; any part of*RawSQL text that varies must be a fragment chosen from a fixed allowlist. - Treat EF Core's raw-SQL analyzers as errors with
dotnet_diagnostic.EF1002.severity = erroranddotnet_diagnostic.EF1003.severity = errorin.editorconfig; both are only warnings by default. EF1002 flags interpolation and EF1003 flags concatenation intoFromSqlRaw,ExecuteSqlRaw, andSqlQueryRaw. Suppress one only at a call whose fragments come from a fixed allowlist, with a comment saying so; sanitizing a request value is not a reason to suppress it. - Do not execute EF’s logged or
ToQueryString()SQL as a parameterized statement; diagnostic SQL may contain display-oriented literal values rather than safe executable bindings. - Bound rows with server-side filtering and pagination before
ToList*, and inspect generated SQL for user-selectableInclude, projection, group, or ordering shapes that can amplify joins and memory. - Keep security predicates server-translatable; EF Core permits client evaluation only in the top-level