Skip to content

Dapper

Dapper is a lightweight relational persistence option for services that need direct SQL control with minimal object mapping overhead.

Use Cases

Use Dapper when:

  • query shape is SQL-first;
  • performance and allocation control matter;
  • a service does not need a full ORM change tracker;
  • read models or reporting queries are easier to express in SQL;
  • a template explicitly enables Dapper persistence.

ConnectSoft Guidance

  • Keep SQL close to the repository or query object that owns it.
  • Use parameterized queries only.
  • Keep transaction boundaries explicit.
  • Align migrations with the selected relational dialect.
  • Test mappings and SQL against representative schemas.

Template Responsibilities

BaseTemplate should document concrete packages, dialect flags, mappings, migrations, repositories, and tests. Layer 3 templates should document only domain-specific repositories, SQL, or disabled persistence options.