Dapper doesn't use prepared statements
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
In most RDBMS that could be replaced by stored procedures, but SQLite doesn't have them. If I need to insert many rows, but cannot do so in a single transaction, I cannot reuse prepared statements. Please see this issue for additional details. In this test using Dapper is now c.25% slower than the manual call.
One idea is to cache queries by sql string, make them prepared, and just populate parameters on every subsequent call. That could be done with some additional overload with an optional parameter prepared = false. Are you interested in supporting this?
Dapper is awesome for automatic mapping, it will be even more awesome and faster with support of prepared statements!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked SQLite performance test and the referenced Microsoft.Data.Sqlite issue to understand the reported comparison and constraints. Trace Dapper's command execution and query-caching paths before deciding how prepared statements would be reused. Done means repeated calls can reuse prepared statements without breaking existing parameter handling or behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql, sqlite
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100