Questions tagged [petapoco]

PetaPoco is a tiny and fast micro-ORM for .NET and Mono.

PetaPoco is a tiny and fast single-file or library referenced micro-ORM for .NET and Mono. It prides itself on being an easy to use and no fuss. Support for all the common databases engines are included (SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, PostgreSQL, and Oracle databases).

Single file

PetaPoco is available as a single file nuget package, with or without T4 templates to generate POCOs from an existing database schema. In the single file form PetaPoco has zero dependencies.

Speed

PetaPoco benchmarks done by the author can be found here. (Note that there have been several performance improvements made in the code since these benchmarks.)

Frans Bouma's benchmarks can be found here


See the PetaPoco website for a full list of features.

429 questions
0
votes
2 answers

How can I force a table column type using Petapoco?

I desire force a datetime mysql column type, because petapoco is creating a timestamp column. [TableName("test"), PrimaryKey("id")] public class Test { [Column("id")] public long id { get; set; } [Column("datetime")] …
Rafael Costa
  • 77
  • 1
  • 6
0
votes
3 answers

Peta poco column caching issue

I am learning about the POCOs and while I like a lot of the concepts, I think I am not quite getting it. I have a problem like the following: I have one sproc which returns multiple columns and values against these columns which dynamically build…
0
votes
2 answers

.Net PetaPoco default query parameters

Given a query string like this SELECT * FROM articles WHERE article_id=@0 OR article_title=@1 Determine total number of parameters (may be regex ?) Pass a default value for each parameter I'm trying to build a testing framework for hardcoded…
MD Luffy
  • 536
  • 6
  • 18
0
votes
1 answer

PetaPoco Varbinary(max) and IdentityColumn

I have problem to get Identity value after inserting row with varbinary(max) column type. Here is the code which I use (according to PetaPoco Page): using (var uow = UnitOfWorkFactory.Create()) { var result = uow.Db.Execute(@"INSERT INTO…
Kamil
  • 149
  • 1
  • 2
  • 10
0
votes
2 answers

DNN DAL2 Normalized Tables One to Many Relationship

I have a module that deals with Products and Options. Where an a product can have multiple options. So say I have a poco class of (partial information here) class Product { public int ProductId { get; set; } public string ProductName {…
0
votes
2 answers

One to Many Relationship with PetaPoco DNN7 DAL2

I am developing a module and I understand PetaPoco with single tables within the DNN7 architecture. I still can't quite figure out how I should be handling One to Many Database relationships. I have 3 tables, Product, Options and ProductMappings…
whreed
  • 133
  • 1
  • 11
0
votes
1 answer

PetaPoco parameter being treated as literal

I'm executing a PetaPoco update statement like this: db.Execute("UPDATE Content SET Html = '@0', PlainText = '@1' WHERE ContentId = @2", newHtml, newText, c.EmailContentId); And the MySQL database is just sticking the parameter name into the field…
LoveMeSomeCode
  • 3,888
  • 8
  • 34
  • 48
0
votes
1 answer

How to return a generic dataset and supplying runtime-known parameters in PetaPoco?

I am binding a result set from a stored procedure to a grid. The stored proc and the number and type of parameters are known during runtime only. I know how to do this in plain ADO.NET. How do I do it using Petapoco? I only used PetaPoco with known…
Tony_Henrich
  • 42,411
  • 75
  • 239
  • 374
0
votes
3 answers

What is recommended lifetime of Database object in a web application?

I consider using PetaPoco in a conventional web app. Saying conventional I mean handling requests in separate threads from a pool requests are quick: no long polling, streaming, etc but not necessarily ASP.NET, it may be for example Nancy What…
amartynov
  • 4,125
  • 2
  • 31
  • 35
0
votes
0 answers

Umbraco 7 mvc existing database connection

I have a new project in umbraco 7 using mvc. I have installed umbraco to an existing database on sql server (nor sql server express). I'm now trying petapoco database connection and inserts…
nickornotto
  • 1,946
  • 4
  • 36
  • 68
0
votes
1 answer

umbraco 7 insert row in custom table

I have just made a model and controller which insert new row in a custom table to my umbraco database. I based it on petapoco tutorial http://creativewebspecialist.co.uk/2013/07/16/umbraco-petapoco-to-store-blog-comments/ Despite the script…
nickornotto
  • 1,946
  • 4
  • 36
  • 68
0
votes
1 answer

PetaPoco one-to-many mapping performance

Looking at the example given on the PetaPoco help section - section "One-To-Many Relationships" It describes how to use InnerJoin and a mapper to handle data mapping of a one-to-many relationship... var authors = db.Fetch( new…
Paul
  • 9,409
  • 13
  • 64
  • 113
0
votes
1 answer

How to create a Join using petapoco MVC4

I need to join 2 table using petapoco MVC4 my table cong shown below [TableName("District")] [PrimaryKey("nDistrictID")] public class District { public int nDistrictID { get; set; } public string cDistrictName { get; set; } public…
0
votes
2 answers

PetaPoco Orderby dynamically created column

is it possible to order by dynamically created column like this (i want sort by AreaPriority, but with this query i get error invalid column name: AreaPriority, when i run this query in SQL Server Managment Studio everything works fine but in…
Dawid PR
  • 117
  • 9
0
votes
1 answer

Can you map column name in SqlFu?

Everything else about this micro ORM looks great, except I can't figure out how to map column name, like [Column("db_username")] public string UserName {get;set;} Did I miss something? Thanks
Whoever
  • 1,295
  • 1
  • 14
  • 21