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

PetaPoco POCO generation fails with Sequence Contains More Then One Matching Element

PostgreSQL 9.5 Npgsql 3.1.9 I have been using PetaPoco with Npgsql to generate the POCO's with the Database.tt. All has worked well until today. After remaking the schema's in PostgreSQL, now running the Database.tt gives the error: // This file…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

Syntax for PetaPoco to return a list of deleted records (from PostgreSQL)?

I have the working PostgreSQL (9.5) delete statement of: delete from dx d using patients p where p.chart_recid = d.chart_recid and p.recid = 15478 and d.icd9_recid = 7574 returning d.recid What is the correct call using PetaPoco? (I am trying to…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

Inserting a new record to PostgreSQL with default values from PetaPoco (and Npgsql)

In PostgreSQL (9.5), I have the following table definition: CREATE TABLE icd9 ( recid serial NOT NULL, code text, cdesc text NOT NULL, "timestamp" timestamp without time zone DEFAULT now(), CONSTRAINT pk_icd9_recid PRIMARY KEY…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

what is the return value of Delete Method?

In PetaPOCO ( http://www.toptensoftware.com/petapoco ) Delete method returns an integer value. What I want to know is, what is the return value of Delete Method? Is it "Number of Records" affected? or is it some "error-code"? I basically want to…
bhattji
  • 19
  • 5
0
votes
1 answer

Improve an SQLite query that returns many records

I have a query that gets executed on an SQLite database table from a WPF application; this query can return a large amount of records (from about 80000 up to about 1 million) which I down-sample before displaying it. It takes about 10 seconds to…
mainvoid
  • 347
  • 1
  • 4
  • 17
0
votes
1 answer

PetaPoco Insert/Update

I have a table with the following field. I am not able to update the existing values in the table. I want to update it based on the SourceId which is not a Primary key (Id is the primary key). Below is the class representation. I do not want to…
Aamir
  • 1
  • 1
  • 4
0
votes
2 answers

PetaPoco insert fails on tables with multiple triggers in PostgreSQL

PetaPoco/Npgsql fails on insert with table trigger. I believe this is very similar to PetaPoco insert fails on table with trigger, the difference being that question was for SQL 2008 and mine is for PostgreSQL 9.5.4 using the Npgsql C# driver with a…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

PetaPoco ExplicitColumns does not work for derived class

If I mark my pseudo-POCO class with ExplicitColumns and mark database column properties with Column attribute, PetaPoco still use properties from base class as if they are in database. Is there some way to avoid this? I dont want to use AutoMapper…
Ondřej
  • 1,645
  • 1
  • 18
  • 29
0
votes
1 answer

Getting return from Oracle function

I'm running into the same problem as outlined in this post: Executing Oracle function and getting back a return value I can do this in my Toad client successfully: declare result varchar2(30); BEGIN result:=WEBUSER.F_UpdateParticipant(json…
MB34
  • 4,210
  • 12
  • 59
  • 110
0
votes
1 answer

Petapoco with factory design pattern for multiple server connections

How can we use multiple connections in petaPOCO with .net MVC application using factory design pattern?
0
votes
1 answer

PetaPoco doesn't throw an exception

I am using PetaPoco and have the following code to get a list of names from the database. public IEnumerable GetManufacturers() { try { statement = "EXEC P_GET_ALL_MANUFACTURER_NAMES"; var data =…
Animesh
  • 4,926
  • 14
  • 68
  • 110
0
votes
1 answer

SQL to text archiving using .net and parallel processing

I have a table that has millions of rows. It has logging data. I want to move the data to text files. Each day's worth of data should go into its own text file. I'm in .net environment. What is the efficient way to achieve it ? I want to use…
0
votes
1 answer

How to execute a PostgreSQL stored procedure from PetaPoco (with Npgsql)?

Given a PostgreSQL (9.5) stored procedure (with Npgsql driver) as: CREATE OR REPLACE FUNCTION "GetAllDx"( patient_recid integer, tencounter timestamp without time zone) RETURNS SETOF view_dx How is this executed from PetaPoco ? Can…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
0 answers

Mapping domain entities into PetaPoco models

I'm using Onion Architecture and PetaPoco micro-orm at my infrastructure layer. How can I map a domain entity from core layer to a petapoco object to access the data via petapoco?
0
votes
1 answer

Petapoco - Calling Oracle pipelined function results in "Unsupported column datatype" exception

I calling a pipelined function in Oracle, I'm getting an "Unsupported column datatype" error and not sure how to remedy this. Here's the code, this is a little simpler than it is in reality but it works exactly the same: CREATE OR REPLACE FUNCTION…
MB34
  • 4,210
  • 12
  • 59
  • 110