PetaPoco: Micro ORM For .NET
PetaPoco is a thin Object Relational Mapper (ORM) for .NET applications. Unlike full-fledged ORMs like NHibernate or Entity Framework, the emphasis is on simplicity of use and performance rather than richness of features. PetaPoco comes in a single C# file, works with strongly typed POCOs, supports class generation with T4 templates and more.
PetaPoco’s most interesting features are
Works with SQL Server, SQL Server CE, MySQL, PostgreSQL and Oracle databases
Helper methods for Insert/Delete/Update/Save and IsNew
Easy Transaction Support
Paged requests automatically work out total record count and fetch a specific page
Parameter replacement Support, can grab named parameters from object properties
Includes a low friction SQL Builder class
Partial Record Updates
Includes T4 Templates to generate POCO classes from database schema
All these features are explained in more detail along with samples in the PetaPoco website.
In terms of performance, PetaPoco is right up there with Dapper, only minimally slower than hand-coded DAL.
There are several tutorials that can help get started – series of blog posts on the official website as well as some independent posts. Besides, since it is open source, it is much easier to add conditions to handle specific scenarios like spatial data.
Micro ORMs have started becoming popular, with many open source projects being released recently. Some of the other well known ones for .NET are Dapper and Massive. These are simpler and more efficient than full-fledged ORMs, often expecting the SQL statement to be hand-written rather than being generated completely dynamically. They also do not need verbose mapping files, that could become tedious to maintain and debug.
No xml mapping files
Anatole Tresch Mar 03, 2015