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
by
Binoj Antony
Educational Content
Concurrency in Clojure
Stuart Halloway May 17, 2013
Confessions of an Agile Addict
Ole Friis Østergaard May 16, 2013
Web Development: You're Doing It Wrong
Stefan Tilkov May 16, 2013
Programming The Feynman Way
Ben Evans May 15, 2013





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think