Skip to content

Docs: Coming from Dapper, side by side and aligned, led by the connection factory - #39

Merged
electricessence merged 2 commits into
masterfrom
docs/coming-from-dapper
Nov 6, 2026
Merged

electricessence merged 2 commits into
masterfrom
docs/coming-from-dapper

Conversation

@electricessence

Copy link
Copy Markdown
Collaborator

Reworks "Coming from Dapper" around the thing that actually differs: who handles the connection. Every comparison is now side by side and aligned row against row, with the SQL predefined once above so the lines stay short.

  • The steps, side by side: (1) get the connection, (2) the command or query, (3) the parameters, (4) the terminal and mapping, in the same order on both sides, with a "nothing" row where one side needs no line, and a tally of the lines you write per call (counted from the compiled snippets): list 4 vs 3, one row 3 vs 3, scalar 3 vs 3, no result set 3 vs 3, transaction 14 vs 6, own connection 4 vs 4, plain ADO.NET list 20 vs 4. The ODE side also states its one-time setup (registering the connection factory once) so the totals are honest.
  • A "What is different" list under each pair about behavior, not syntax: who creates, opens and disposes the connection and how long it stays open, buffered versus streamed rows, no-row and several-row behavior, mapping rules, null parameters, async and cancellation, exceptions. Every Dapper statement is checked against Dapper's source (SqlMapper.cs, DefaultTypeMap.cs, CommandDefinition.cs); every ODE statement against the code or a test.
  • Two facts stated plainly so nobody is confused: Dapper opens a closed connection for plain queries (and closes it again), so Open() is optional there; ADO.NET requires an open connection to begin a transaction, so transaction code opens it explicitly, and the ODE transaction helpers open it for you and close only what they opened.
  • The same two-column component is reused in Getting started (factory vs own connection, plain ADO.NET vs ODE) and Expressive commands. It is a small CSS grid in the template (stacks under 768 px; rows share a subgrid so they stay aligned).
  • Code comes from docsite/samples/ConnectionPattern.cs (compiled and run by the build: 51 checks pass, 0 warnings). The README is untouched; it will link to these comparisons after the pending mapping PR merges.

Verified locally: DocFX 0 errors (231 warnings, all the known duplicate-parameter ones from XML docs in other branches, none from this content), 5,937 relative links and 2,059 anchors checked with none broken, two columns aligned at 1100 px and stacked at 375 px, light and dark. Screenshots below. The Docs check builds the site on this PR.

🤖 Generated with Claude Code

The transaction comparison, Dapper on the left, Open.Database.Extensions on the right

The top of the Coming from Dapper page

electricessence and others added 2 commits November 5, 2026 17:46
…-side comparisons

- The Dapper article now opens with the connection: who creates, opens and disposes it.
  Dapper opens a closed connection for plain queries (SqlMapper.cs, wasClosed); ADO.NET
  needs an open connection to begin a transaction. Each comparison has the same rows in
  the same order (connection, command, parameters, terminal), a per-call line tally taken
  from the compiled snippets, and a short list of behavior differences. Covers a list, one
  row, a scalar, a command with no result set, a transaction and a connection you own.
- A reusable two-column component (templates/custom/public/main.css, .side-by-side) is
  used by Getting started (factory versus own connection, plain ADO.NET versus the
  extensions) and Expressive commands (factory versus connection form).
- docsite/samples/ConnectionPattern.cs holds the compared snippets, the one-time factory
  setup and a dependency-injection example; Program.cs checks that both sides agree.
  NOT BUILT OR RUN YET: written during a benchmark window.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each column is a subgrid over two shared rows (heading, code), so the code blocks start on the same line even when one heading wraps (the "own connection" heading wrapped and pushed its code down 24 px). Checked in the browser at 1100 px and 375 px, light and dark: all six comparisons align, highlighting works, the columns stack under 768 px and the page does not overflow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit a0a0058 into master Nov 6, 2026
2 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