Skip to content

Reimagine DapperExtension as Writeback - #1

Merged
Murat7Ay merged 1 commit into
masterfrom
reimagine-2026
Oct 1, 2026
Merged

Murat7Ay merged 1 commit into
masterfrom
reimagine-2026

Conversation

@Murat7Ay

@Murat7Ay Murat7Ay commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

This rewrites the 2017 SQL Server-only helper as Writeback, the write side of Dapper:

  • Generated values come back. Insert, update and delete write every database-generated value (identity, defaults, computed, rowversion) back into the entity, on SQL Server, PostgreSQL, MySQL and SQLite.
  • SQL Server tables with triggers work. A trigger-safe path covers them (the bug the last two legacy commits worked around).
  • Batches return every key. InsertManyAsync/UpdateManyAsync/DeleteManyAsync are chunked to parameter limits, transactional, and correlate keys exactly.
  • Lost updates throw. Optimistic concurrency via [ConcurrencyCheck]/[Timestamp] raises ConcurrencyConflictException.
  • Real bulk loading. Writeback.SqlServer and Writeback.PostgreSql add BulkCopyAsync (SqlBulkCopy / binary COPY).
  • Renamed from DapperExtension to avoid confusion with the existing DapperExtensions package (ADR-014). Licensed MIT.

Design rationale is in docs/PRODUCT_THESIS.md, docs/architecture/ARCHITECTURE.md and docs/architecture/DECISIONS.md. The self-review findings are in docs/architecture/REVIEW.md.

Testing

  • 87 unit tests: mapping and exact SQL per dialect.
  • 97 integration tests against real SQLite, PostgreSQL 18, MySQL 8.4 and SQL Server 2022 (Testcontainers), all passing locally.
  • BenchmarkDotNet comparison with raw Dapper and EF Core 10 in docs/BENCHMARKS.md.

🤖 Generated with Claude Code

Rewrite of the 2017 SQL Server-only helper as a modern .NET 8/10 library
for insert/update/delete with database-generated values written back,
optimistic concurrency and honest batching on SQL Server, PostgreSQL,
MySQL and SQLite.

- Mapping from standard DataAnnotations, conventions and a fluent API
- Dialects render a small statement model; trigger-safe SQL Server path
- InsertMany/UpdateMany/DeleteMany: chunked, transactional, exact key
  correlation (MERGE position / result set per row)
- Writeback.SqlServer and Writeback.PostgreSql: SqlBulkCopy / binary COPY
- 87 unit tests, 97 integration tests on four real databases, benchmarks
- Docs: product thesis, ecosystem research, architecture, 14 ADRs,
  self-review, recipes, migration guide

Renamed from DapperExtension to avoid confusion with the existing
DapperExtensions package (ADR-014). Licensed MIT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Murat7Ay
Murat7Ay merged commit e7457a8 into master Oct 1, 2026
1 check 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