/README.markdown

http://github.com/toptensoftware/PetaPoco · Markdown · 109 lines · 82 code · 27 blank · 0 comment · 0 complexity · dbde34846affc242b98a3a22ad69a2ca MD5 · raw file

  1. <img align="right" alt="PetaPoco Logo" width="128" src="https://raw.githubusercontent.com/CollaboratingPlatypus/PetaPoco/master/Media/Logo2/PetaPocoLogo2_256.png">
  2. # Welcome to the official PetaPoco repository
  3. Originally the brainchild of [Brad Robinson]
  4. ## Version 6 - Netstandard 2.0+, 4.0, 4.5+
  5. Read more about the [v6 update](https://github.com/CollaboratingPlatypus/PetaPoco/wiki/V6NetStandard2-0)
  6. PetaPoco is available from: **NuGet [PetaPoco.Complied](https://www.nuget.org/packages/PetaPoco.Compiled)**
  7. |Master|Development|Nuget|
  8. |:-----|:----------|:----|
  9. |[![Build status](https://ci.appveyor.com/api/projects/status/1vodaox1reremsvj/branch/master?svg=true)](https://ci.appveyor.com/project/collaboratingplatypus/petapoco/branch/master)|[![Build status](https://ci.appveyor.com/api/projects/status/1vodaox1reremsvj/branch/development?svg=true)](https://ci.appveyor.com/project/collaboratingplatypus/petapoco/branch/development)|[![Nuget Downloads](https://buildstats.info/nuget/PetaPoco.Compiled)](https://www.nuget.org/packages/PetaPoco.Compiled/)|
  10. ### Documentation
  11. For configuration, code examples and other general information [See the docs]
  12. ### Add-ons
  13. * [PetaPoco.SqlKata](//github.com/asherber/PetaPoco.SqlKata) lets you use the powerful query builder [SqlKata](//sqlkata.com) to [build SQL queries](//github.com/CollaboratingPlatypus/PetaPoco/wiki/Building-SQL-Queries) for PetaPoco.
  14. * [StaTypPocoQueries.PetaPoco](//github.com/asherber/StaTypPocoQueries.PetaPoco) provides the ability to use some simple, strongly typed, Intellisensed LINQ expressions in your queries.
  15. * [PetaPoco.DBEntityGenerator](//github.com/hippasus/PetaPoco.DBEntityGenerator) lets you generate Pocos from your DB (T4 template replacement).
  16. ## Version 5 - Legacy
  17. |Nuget (Single file)|Nuget Core (+t4 templates)|Nuget Core Compiled (dll)|
  18. |:----|:---------|:------------------|
  19. |[![Nuget Downloads](https://buildstats.info/nuget/PetaPoco)](https://www.nuget.org/packages/PetaPoco/)|[![Nuget Downloads core](https://buildstats.info/nuget/PetaPoco.Core)](https://www.nuget.org/packages/PetaPoco.Core)|[![Nuget Downloads core](https://buildstats.info/nuget/PetaPoco.Core.Compiled)](https://www.nuget.org/packages/PetaPoco.Core.Compiled)|
  20. ---
  21. ## PetaPoco is a tiny & fast micro-ORM for .NET
  22. * Like [Dapper], it's fast because it uses dynamic method generation (MSIL) to assign column values to properties
  23. * Like [Massive], it now also supports dynamic Expandos too
  24. * Like [ActiveRecord], it supports a close relationship between object and database table
  25. * Like [SubSonic], it supports generation of poco classes with T4 templates (V5 only)
  26. * Like [Massive] it's available as single file that you easily add to any project or complied. (V5 only)
  27. ## Features at a Glance
  28. * Tiny, and absolutely no dependencies!
  29. * Asychronise or synchronise, the choice is yours. (aka async) (V6)
  30. * Works with strictly undecorated POCOs, or attributed almost-POCOs.
  31. * Easy to configure and includes [fluent configuration] out of the box.
  32. * Helper methods for Insert/Delete/Update/Save and IsNew
  33. * Paged requests automatically work out total record count and fetch a specific page.
  34. * Easy transaction support.
  35. * Better parameter replacement support, including grabbing named parameters from object properties.
  36. * Great performance by eliminating Linq and fast property assignment with DynamicMethod generation.
  37. * The query language is good ole SQL.
  38. * Includes a low friction SQL builder class that makes writing inline SQL *much* easier.
  39. * Includes T4 templates to automatically generate POCO classes for you. (V5)
  40. * Hooks for logging exceptions, installing value converters and mapping columns to properties without attributes.
  41. * Works with SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, Firebird, and PostgreSQL. (Oracle supported but does not have integration tests).
  42. * Works under Net Standard 2.0, .NET 4.0/4.5+ or Mono 2.8 and later.
  43. * Has [Xunit] unit tests.
  44. * Has supported DBs integration tests.
  45. * OpenSource (MIT License or Apache 2.0)
  46. ## Super easy use and configuration
  47. Save an entity
  48. ```c#
  49. db.Save(article);
  50. db.Save(new Article { Title = "Super easy to use PetaPoco" });
  51. db.Save("Articles", "Id", { Title = "Super easy to use PetaPoco", Id = Guid.New() });
  52. ```
  53. Get an entity
  54. ```c#
  55. var article = db.Single<Article>(123);
  56. var article = db.Single<Article>("WHERE ArticleKey = @0", "ART-123");
  57. ```
  58. Delete an entity
  59. ```c#
  60. db.Delete(article);
  61. db.Delete<Article>(123);
  62. db.Delete("Articles", "Id", 123);
  63. db.Delete("Articles", "ArticleKey", "ART-123");
  64. ```
  65. Plus much much [more](https://github.com/CollaboratingPlatypus/PetaPoco/wiki).
  66. [Brad Robinson]:http://www.toptensoftware.com/
  67. [Massive]:https://github.com/FransBouma/Massive
  68. [Dapper]:https://github.com/StackExchange/dapper-dot-net
  69. [SubSonic]:http://subsonic.github.io/
  70. [ActiveRecord]:http://guides.rubyonrails.org/active_record_basics.html
  71. [POCO]:http://en.wikipedia.org/wiki/Plain_Old_CLR_Object
  72. [CodingHorror]:http://www.subsonicproject.com/docs/CodingHorror
  73. [XUnit]:https://github.com/xunit/xunit
  74. [See the docs]:https://github.com/CollaboratingPlatypus/PetaPoco/wiki
  75. [the contribution guide]:./contributing.md
  76. [Contributing to Open Source on GitHub]:https://guides.github.com/activities/contributing-to-open-source/
  77. [we have a special place to honour them]:./honourRoll.md
  78. [fluent configuration]:https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Fluent-Configuration
  79. ## Contributing
  80. PetaPoco welcomes input from the community. After all, what is a product without users? If youd 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].
  81. ## Contributions Honour Roll
  82. 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].