Cloud Parts

Micro-ORMs

Run the SQL you write and copy each result row into an object by matching column names to properties, and do little else.

How they work

A micro-ORM keeps only the tedious part of mapping: turning a result set into objects. Dapper adds extension methods such as Query<T> and Execute to an ADO.NET connection; you pass SQL and parameters, and it fills objects by column name, caching what it learns about each query so the next one maps faster. It can split one joined row into several objects, but it has no identity map, change tracking, lazy loading or migrations. Its README says plainly that “many features that ORMs ship with are stripped out”.

Stack Overflow built Dapper in 2011 because LINQ to SQL was spending CPU generating mapping code on every request. The kind suits hot paths, read models and teams that already write their SQL by hand and only want to stop copying columns into fields.

Technologies

What all object-relational mapping have in common →

Sources

Improve this page on GitHub