Home Projects Issues Blogs Broadcasts Resources
Project

PetaPoco

Official PetaPoco, A tiny ORM-ish thing for your POCO's

PetaPoco Logo

Welcome to the official PetaPoco repository

Originally the brainchild of Brad Robinson.

PetaPoco is currently maintained and exteneded by Wade Baglin (@pleb) and Aaron Sherber (@asherber).

Version 6 - Netstandard 2.0+, 4.0, 4.5+

Read more about the v6 update

PetaPoco is available from: NuGet PetaPoco.Compiled

Master Development Nuget
Build status Build status Nuget Downloads

Documentation

For configuration, code examples and other general information See the docs

Add-ons

Version 5 - Legacy

Nuget (Single file) Nuget Core (+t4 templates) Nuget Core Compiled (dll)
Nuget Downloads Nuget Downloads core Nuget Downloads core

PetaPoco is a tiny & fast micro-ORM for .NET

  • Like Dapper, it's fast because it uses dynamic method generation (MSIL) to assign column values to properties
  • Like Massive, it now also supports dynamic Expandos too
  • Like ActiveRecord, it supports a close relationship between object and database table
  • Like SubSonic, it supports generation of poco classes with T4 templates (V5 only)
  • Like Massive it's available as single file that you easily add to any project or complied. (V5 only)

Features at a Glance

  • Tiny, and absolutely no dependencies!
  • Asychronise or synchronise, the choice is yours. (aka async) (V6)
  • Works with strictly undecorated POCOs, or attributed almost-POCOs.
  • Easy to configure and includes fluent configuration out of the box.
  • Helper methods for Insert/Delete/Update/Save and IsNew
  • Paged requests automatically work out total record count and fetch a specific page.
  • Easy transaction support.
  • Better parameter replacement support, including grabbing named parameters from object properties.
  • Great performance by eliminating Linq and fast property assignment with DynamicMethod generation.
  • The query language is good ole SQL.
  • Includes a low friction SQL builder class that makes writing inline SQL much easier.
  • Includes T4 templates to automatically generate POCO classes for you. (V5)
  • Hooks for logging exceptions, installing value converters and mapping columns to properties without attributes.
  • Works with SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, Firebird, and PostgreSQL. (Oracle supported but does not have integration tests).
  • Works under Net Standard 2.0, .NET 4.0/4.5+ or Mono 2.8 and later.
  • Has Xunit unit tests.
  • Has supported DBs integration tests.
  • OpenSource (MIT License or Apache 2.0)

Super easy use and configuration

Save an entity

    db.Save(article);
    db.Save(new Article { Title = "Super easy to use PetaPoco" });
    db.Save("Articles", "Id", { Title = "Super easy to use PetaPoco", Id = Guid.New() });

Get an entity

    var article = db.Single<Article>(123);
    var article = db.Single<Article>("WHERE ArticleKey = @0", "ART-123");

Delete an entity

    db.Delete(article);
    db.Delete<Article>(123);
    db.Delete("Articles", "Id", 123);
    db.Delete("Articles", "ArticleKey", "ART-123");

Plus much much more.

Contributing

PetaPoco welcomes input from the community. After all, what is a product without users? If you’d like to contribute, please take the time to read the contribution guide. We would also suggest you have a quick read of Contributing to Open Source on GitHub.

Contributions Honour Roll

A product like PetaPoco isn't the effort of one person, but rather a combined effort of many. For those individuals who rise above and beyond we have a special place to honour them.

NuGet

PetaPoco (fuget.org)
609,045 Total Downloads 165 Downloads Per Day Latest Version: 99,166 (July 2, 2018) Hide All Versions Show All Versions
Version Downloads Last Updated
7/2/2018 July 2, 2018
7/2/2018 July 2, 2018
7/2/2018 July 2, 2018
7/2/2018 July 2, 2018
6/1/2018 June 1, 2018
6/1/2018 June 1, 2018
5/1/2018 May 1, 2018
4/12/2018 April 12, 2018
4/11/2018 April 11, 2018
4/11/2018 April 11, 2018
4/11/2018 April 11, 2018
4/6/2018 April 6, 2018
3/22/2018 March 22, 2018
12/13/2017 December 13, 2017
12/4/2017 December 4, 2017
11/29/2017 November 29, 2017
11/29/2017 November 29, 2017
11/29/2017 November 29, 2017
7/23/2017 July 23, 2017
7/23/2017 July 23, 2017
5/17/2017 May 17, 2017
5/17/2017 May 17, 2017
5/17/2017 May 17, 2017
5/11/2017 May 11, 2017
5/4/2017 May 4, 2017
5/4/2017 May 4, 2017
4/10/2017 April 10, 2017
3/21/2017 March 21, 2017
3/21/2017 March 21, 2017
2/2/2017 February 2, 2017
2/2/2017 February 2, 2017
1/3/2017 January 3, 2017
8/16/2016 August 16, 2016
8/15/2016 August 15, 2016
8/12/2016 August 12, 2016
8/6/2016 August 6, 2016
8/5/2016 August 5, 2016
8/5/2016 August 5, 2016
8/3/2016 August 3, 2016
7/31/2016 July 31, 2016
7/30/2016 July 30, 2016
7/30/2016 July 30, 2016
7/30/2016 July 30, 2016
7/29/2016 July 29, 2016
7/29/2016 July 29, 2016
7/29/2016 July 29, 2016
7/29/2016 July 29, 2016
7/20/2016 July 20, 2016
7/20/2016 July 20, 2016
7/18/2016 July 18, 2016
7/16/2016 July 16, 2016
7/15/2016 July 15, 2016
7/15/2016 July 15, 2016
7/15/2016 July 15, 2016
7/15/2016 July 15, 2016
7/15/2016 July 15, 2016
7/12/2016 July 12, 2016
7/12/2016 July 12, 2016
7/6/2016 July 6, 2016
7/6/2016 July 6, 2016
5/27/2016 May 27, 2016
5/27/2016 May 27, 2016
5/26/2016 May 26, 2016
5/26/2016 May 26, 2016
5/24/2016 May 24, 2016
5/24/2016 May 24, 2016
5/24/2016 May 24, 2016
4/13/2016 April 13, 2016
4/13/2016 April 13, 2016
4/13/2016 April 13, 2016
4/13/2016 April 13, 2016
3/15/2016 March 15, 2016
3/15/2016 March 15, 2016
3/6/2016 March 6, 2016
3/6/2016 March 6, 2016
3/4/2016 March 4, 2016
2/16/2016 February 16, 2016
2/14/2016 February 14, 2016
2/9/2016 February 9, 2016
2/8/2016 February 8, 2016
2/8/2016 February 8, 2016
2/8/2016 February 8, 2016
2/6/2016 February 6, 2016
1/31/2016 January 31, 2016
1/30/2016 January 30, 2016
1/30/2016 January 30, 2016
1/30/2016 January 30, 2016
1/30/2016 January 30, 2016
1/30/2016 January 30, 2016
1/28/2016 January 28, 2016
1/28/2016 January 28, 2016
1/25/2016 January 25, 2016
1/21/2016 January 21, 2016
1/20/2016 January 20, 2016
1/20/2016 January 20, 2016
1/20/2016 January 20, 2016
1/20/2016 January 20, 2016
1/11/2016 January 11, 2016
1/10/2016 January 10, 2016
1/10/2016 January 10, 2016
1/10/2016 January 10, 2016
1/10/2016 January 10, 2016
1/5/2016 January 5, 2016
1/5/2016 January 5, 2016
1/4/2016 January 4, 2016
12/30/2015 December 30, 2015
12/29/2015 December 29, 2015
12/29/2015 December 29, 2015
12/28/2015 December 28, 2015
12/28/2015 December 28, 2015
12/22/2015 December 22, 2015
12/19/2015 December 19, 2015
12/16/2015 December 16, 2015
12/16/2015 December 16, 2015
12/15/2015 December 15, 2015
12/15/2015 December 15, 2015
12/15/2015 December 15, 2015
12/15/2015 December 15, 2015
12/14/2015 December 14, 2015
12/13/2015 December 13, 2015
12/13/2015 December 13, 2015
12/13/2015 December 13, 2015
12/13/2015 December 13, 2015
12/13/2015 December 13, 2015
12/13/2015 December 13, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/12/2015 December 12, 2015
12/8/2015 December 8, 2015
12/8/2015 December 8, 2015
12/6/2015 December 6, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
12/5/2015 December 5, 2015
3/2/2013 March 2, 2013
6/27/2011 June 27, 2011
6/3/2011 June 3, 2011
6/2/2011 June 2, 2011
5/17/2011 May 17, 2011
5/1/2011 May 1, 2011
4/29/2011 April 29, 2011
4/21/2011 April 21, 2011
4/21/2011 April 21, 2011
4/13/2011 April 13, 2011
4/11/2011 April 11, 2011
4/8/2011 April 8, 2011
4/7/2011 April 7, 2011
4/6/2011 April 6, 2011
4/6/2011 April 6, 2011
4/6/2011 April 6, 2011
4/5/2011 April 5, 2011
4/5/2011 April 5, 2011
4/4/2011 April 4, 2011
4/2/2011 April 2, 2011
4/2/2011 April 2, 2011
3/24/2011 March 24, 2011
3/23/2011 March 23, 2011
3/22/2011 March 22, 2011
3/22/2011 March 22, 2011
3/21/2011 March 21, 2011
3/21/2011 March 21, 2011
1798
574
91
Source Code

{{ 'https://github.com/CollaboratingPlatypus/PetaPoco' | no-protocol }}

NuGet