Skip to content

Fix database issues#101

Merged
bradsp merged 5 commits intomainfrom
fix-database-issues
Feb 3, 2026
Merged

Fix database issues#101
bradsp merged 5 commits intomainfrom
fix-database-issues

Conversation

@bradsp
Copy link
Owner

@bradsp bradsp commented Feb 3, 2026

This is a fix to resolve Sql Server parameterization issues causing performance degradation with database queries.

bradsp and others added 5 commits February 2, 2026 13:30
Added a detailed technical analysis (sql-plan-cache-pollution-analysis.md) reviewing all repository and service files for SQL Server plan cache pollution risks. The document identifies 28 anti-patterns across 7 categories, explains their impact, and provides recommended fixes. It includes severity categorization, code examples, architectural assessments, remediation strategies, and a complete file inventory. This serves as a guide for improving SQL query consistency, performance, and maintainability.
Parameterize queries to eliminate plan cache pollution identified in the
analysis document. Adds WhereLike/WhereOptional helpers to
RepositoryCoreBase, fixes SQL injection in AccountSearchRepository IN
clause, parameterizes interpolated values in UPDATE statements, converts
dynamic WHERE assembly to consistent query shapes using IS NULL guards,
replaces hardcoded string literals with SqlParameter, and converts raw
SQL to Sql.Builder pattern.

Addresses 28 issues across CRITICAL (5), HIGH (8), and MEDIUM (4)
priority tiers in 17 files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Expanded allowed permissions in settings.local.json to include additional Bash commands and Visual Studio/MSBuild operations. Removed commandLineArgs ("/TEST") from Lab Billing WinForms UI profile in launchSettings.json, leaving only commandName.
PetaPoco internally renumbers positional placeholders when @0 appears
twice in a WHERE clause (e.g., @0 IS NULL OR column = @0), but reuses
the same SqlParameter object instance for both slots. ADO.NET throws
SqlParameter is already contained by another SqlParameterCollection.

Fix uses @0/@1 with two separate SqlParameter instances carrying the
same value. Also updates WhereOptional helper to clone SqlParameter
when the value is a SqlParameter instance.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added "WebFetch(domain:github.com)" and "WebSearch" command patterns to settings.local.json to enable GitHub web fetching and general web search functionality. No existing commands were changed.
@bradsp bradsp merged commit 2b6da76 into main Feb 3, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant