Remove Dapper dependency - replace with custom ADO.NET extensions#26
Closed
Copilot wants to merge 4 commits into
Closed
Remove Dapper dependency - replace with custom ADO.NET extensions#26Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…ts pass Co-authored-by: idotta <4734635+idotta@users.noreply.github.com>
Co-authored-by: idotta <4734635+idotta@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate necessity of Dapper for SQLite access
Remove Dapper dependency - replace with custom ADO.NET extensions
Jan 22, 2026
…d SchemaIntrospector files
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This pull request has been automatically closed due to inactivity. Please feel free to reopen if you would like to continue working on this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Investigated whether Dapper adds value beyond basic ADO.NET. Conclusion: it doesn't for our use case. Replaced with lightweight extensions (~400 LOC) that provide identical API surface.
Changes
Core Implementation
AdoNetExtensions.cs: Drop-in replacement for Dapper methods (ExecuteAsync,QueryAsync<T>,QueryFirstOrDefaultAsync<T>,ExecuteScalarAsync<T>)AmbientTransaction: AsyncLocal-based transaction detection eliminates need to thread transactions through call chainsDynamicParameters: Simple implementation for bulk operationsUpdated Components
DocumentStore.cs: Changedusing Dapper→using LiteDocumentStore.DataMigrationRunner.cs: Wrapped Up/Down calls in ambient transaction scopeSchemaIntrospector.cs: Direct DataReader access for PRAGMA queries (Dapper couldn't infer dynamic column types)DateTimeOffsetHandler.cs(folded intoSetParameterValue)Test Adjustments
QueryAsync<dynamic>calls with concrete DTOs (4 test methods)Technical Notes
Transaction handling: SQLite doesn't expose active transactions publicly. Using AsyncLocal to track transaction scope avoids reflection and provides clean API:
Type mapping: Handles primitive types, DateTimeOffset (ISO 8601), JSONB blobs, and complex types via reflection. Uses
EqualityComparer<T>.Defaultfor proper null/default handling across reference and value types.Dependencies: Dapper 2.1.66 removed. Package size reduced. One fewer supply chain dependency.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.