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
4
votes
1 answer

Petapoco and Azure SQL Connection Pool

At the heart of Petapoco.cs there is the function OpenShareConnection. I believe this cannot take advantage of the Connection Pool in SQL Azure. I am monitoring my connections and the connection count grows above the pool limit. Anyone has done some…
Uri Kluk
  • 185
  • 8
4
votes
3 answers

Replacements to hand-rolled ADO.NET POCO mapping?

I have written a wrapper around ADO.NET's DbProviderFactory that I use extensively throughout my applications. I also have written a lot of code that maps IDataReader rows to POCOs. However, as I have tons of classes the whole thing is getting to be…
ScottD
  • 173
  • 5
  • 15
4
votes
1 answer

ASP.Net Web API architecture choices

The following is a schematic overview of the situation: WEBSERVER <----> MIDDLEWARE SERVER <----> Database Webserver: IIS / ASP.net 4.0 (WebForms & MVC) Middleware server: WCF Services Database server: Oracle The webserver is physically seperated…
4
votes
1 answer

Should the PetaPoco database class be created once per request or every time it is needed?

With PetaPoco, how should I handle the creation of the Database class? My application will probably be making use of various repositories (not quite the DDD repository, more like a gateway repository) to encapsulate the queries. Since I'll have…
Wayne Molina
  • 19,158
  • 26
  • 98
  • 163
4
votes
1 answer

PetaPoco: Fetching into composite object

I'm familiarizing with PetaPoco (it looks great btw), but have one blocker here, and I'm curious if I can do that in PetaPoco. What I would like to do, is to map one row in the database into a composite object. I think that example will clear things…
Biegal
  • 41
  • 1
  • 2
3
votes
1 answer

What's the reasoning behind result columns being excluded from auto-select statements in PetaPoco

If I have a POCO class with ResultColumn attribute set and then when I do a Single() call, my result column isn't mapped. I've set my column to be a result column because its value should always be generated by SQL column's default…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
3
votes
4 answers

Can't figure out exception message

I am having the following error message and I am using petaPOCO. Why am I having this error message and What am I doing wrong to have this message: {"There is already an open DataReader associated with this Command which must be closed…
learning
  • 11,415
  • 35
  • 87
  • 154
3
votes
1 answer

PetaPoco over multiple databases

Don't ask why but there are four databases. One of which I have rights to modify the schema. Let's call it external. Again, it's a legacy deal but there are about 60 tables in one of the other three databases, called main. Each record in those…
Guy--L
  • 170
  • 2
  • 13
3
votes
1 answer

Paged, Multi-Poco queries with Petapoco?

PetaPoco is great and covers paged queries and Multi-Poco mapping, but I'm trying to figure out if there's a way to do them together? Edit: Here's the repository method I use to get MultiPoco data: // variables, used in multiple repo…
seekay
  • 2,493
  • 3
  • 27
  • 33
3
votes
3 answers

Updating database in Transaction from List

I have a database table which has 2 columns and I have a List where T has 2 properties. How can I create a transaction so that I can effectively say: UPDATE MyTable SET ColumnA = List 1st property WHERE ColumnB = List 2nd Property A…
Jon
  • 38,814
  • 81
  • 233
  • 382
3
votes
2 answers

Implementing Repository pattern with PetaPoco

Just started a 'real world' project using .NET MVC, Ninject, PetaPoco and plan to use the repository pattern. I used the PetaPoco T4 template w/ 'GenerateOperations', 'GeneratePocos', and 'GenerateCommon' all = true. Looking at the generated code,…
seekay
  • 2,493
  • 3
  • 27
  • 33
3
votes
4 answers

Invalid cast exception when trying to map from int? to enum?

I have a senario where a user wants to select his gender which is not a mandatory field. Here in my ui the gender is listed in dropdownlist which has two options Male and Female and has a optional label Gender. But the Gender is a enum in my project…
Febin J S
  • 1,358
  • 3
  • 26
  • 53
3
votes
3 answers

What is the maximum allowed size for a SQLite DB and can I use PetaPoco as an ORM?

What is the maximum allowed size for a SQLite database in a Windows Forms application? Can I use PetaPoco as an ORM, or can you suggest a similar ORM?
David
  • 5,403
  • 15
  • 42
  • 72
3
votes
1 answer

Integrate PetaPoco v6 with asp.NET core

I am trying to use petapoco with my .NET core MVC application, I have installed petapoco compiled as stated in another answer but don't know what to do next, I searched many places but most of them had been using the previous versions of petapoco…
VR7
  • 112
  • 3
  • 16
3
votes
2 answers

PetaPoco INSERT with @ in the string

I want to Execute a line of SQL which looks like this: conn.Open(); var db = new PetaPoco.Database(conn); var sql = "INSERT INTO FOO (name) VALUES ( 'foo@bar.com')"; var response = db.Execute(sql); The problem is that PetaPoco thinks @bar is a…
Daniel Williams
  • 8,912
  • 15
  • 68
  • 107