PetaPoco is a small, dependency-free .NET ORM for mapping POCOs to SQL databases with sync or async APIs.
Overview
PetaPoco provides database access for .NET applications without the weight of a full ORM stack. It maps plain CLR objects to tables using SQL as the query language, dynamic method generation for fast column-to-property assignment, and optional attributes or fluent configuration when you need stricter mapping.
Helper methods cover insert, update, delete, save, and paged queries that compute total counts automatically. Transactions, named parameters from object properties, SQL builder utilities, logging hooks, and value converters are built in. Version 6 targets .NET Standard 2.0 and modern .NET with asynchronous operations alongside synchronous calls.
Supported databases include SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, Firebird, and PostgreSQL, with Oracle supported but without integration tests in the project. Distribution is primarily through the NuGet PetaPoco.Compiled package; older single-file distributions remain documented for legacy v5 users.
The design compares philosophically to Dapper, Massive, and ActiveRecord-style tools while keeping a single focused API for CRUD and ad hoc SQL in application code.
Key features
- POCO mapping without heavy attributes
- Sync and async database APIs
- Insert, update, delete helpers
- Automatic paged queries
- Fluent configuration support
- Inline SQL builder
- Multiple database providers
- Transaction support
Use cases
- .NET apps needing simple SQL ORM
- Lightweight data access layers
- Multi-database .NET services
- Paged list queries