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

Returning record ID's from PostgreSQL using PetaPoco

PetaPoco PostgreSQL 11.1 I am attempting to get a list of deleted record id's. This does NOT work: var sql = new Sql() .Append(@"; WITH _in (lastname, firstname, birthdate, description, dencounter) AS ( VALUES ( UPPER(@0),…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

Casting double from petapoco sql request with MS Access decimal separator comma

I'm getting records from a MS Access database. The database decimal separator is comma and I can't change it. The value from the SQL result casted into Double return wrong value as it's not the same in the database, I guess because of different…
0
votes
0 answers

How to call oracle stored procedure using petapoco

We have recently changed from ADO to Peta Poco. Connecting to SQL Server is quite easy and is getting familiar with it. However, I can't find a way to connect to Oracle database. These are the syntaxes I tried. var records =…
vivek kv
  • 406
  • 6
  • 11
0
votes
1 answer

Adding [ResultColumn] to Database.tt in PetaPoco

I am an avid user of PetaPoco. Is there any way to tweak the Database.tt (for generation of POCO's) to specify a ResultColumn in a specific table? TIA Currently, the Database.tt states: // Tweak Schema tables["tablename"].Ignore = true; …
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
0
votes
1 answer

How to filter database records based on static dropdownlist in mvc 5

i want to filter database record based on database column QtyRecieved,QtyRecievedand Void using static html dropdwonlist QtyRecieved,QtyRecieved is decimal and void is boolean here is what i have tried @Html.DropDownList("Filter", new…
kunals
  • 43
  • 9
0
votes
1 answer

How do I integrate a database into asp.net project using Postgresql and Petapoco?

I am not very good at setting up a project at all. I am working on an application in VS that uses ASP.NET with MVC framework. I am wanting to use a Postgresql database and use it in my project with Petapoco. I have tried everything, and I added a…
0
votes
1 answer

In PetaPoco, how is it possible to define a table with 2 primary keys?

I saw on different forums that it's possible to define 2 primary keys for 1 table like this : [PetaPoco.PrimaryKey("key1,key2")] But When I try to do that : db.SingleOrDefault(Object); I have an error message…
yannick
  • 137
  • 1
  • 12
0
votes
0 answers

Petapoco cant find split point

Im getting an error i cant really understand. I have checked that the models correspond to the database tables but still i get an error that makes me think System.InvalidOperationException: Couldn't find split point between App.Model.SimCarBox…
Daarwin
  • 2,896
  • 7
  • 39
  • 69
0
votes
1 answer

Incorrect syntax near 'PETA_PAGED' added by peta poco .net pagination query

i am getting Incorrect syntax near 'PETA_PAGED' where i was using the tenantaware database to get the data from the data base and here is the query which i was using select Id, Name from ListView where IsPartOf = 0 and after coming to the this…
Sandeep Bhaskar
  • 300
  • 2
  • 12
0
votes
3 answers

How to convert date format in string using SQL query?

I am using ASP.NET MVC with petapoco. I want to display data from database table in the view as it has date column and I want to convert that date format in varchar like 'dd-mm-yyyy'. My date column is TransactionDate. My query is as follows, I…
prathamesh93
  • 1
  • 1
  • 5
0
votes
2 answers

Batch insert data in table that has a parent child relationship

I am working on a function that would insert a data in a table that has a parent child relationship. My current implementation is to iterate the objects to insert them one by one. I am thinking of batch insert to lessen the database round trip using…
cris gomez
  • 131
  • 1
  • 15
0
votes
1 answer

How to convert petapocohelper executereader to List [C#]

I'm developing .cs code to get data from a Stored Procedure and store it to a List but i'm having trouble getting all datasets to the List. The SP: ALTER PROCEDURE [_testSchm].[_test_sp] @paramINint int, @paramINnvarchar nvarchar(max), …
0
votes
1 answer

how to make DisplayName in MVC model?

while I was building MVC5 model with SQLite. the time span is tricky so I stored the tick instead. but then I get trouble on display name for it. [PetaPoco.TableName("UserStatus")] [PetaPoco.PrimaryKey("iUserId", AutoIncrement = true)] public class…
0
votes
1 answer

How to use SQLite with PetaPoco

I'm try to use PetaPoco with SQLite on MVC5. I created a model to make the mapping. namespace LittleDemo.Models.UserModel { [PetaPoco.TableName("User")] [PetaPoco.PrimaryKey("UserId", AutoIncrement = true)] public class User { …
0
votes
1 answer

(SQLite) Error: attempt to write to a readonly database

I have recently written a C# program whose functionality is to create and populate three tables in a SQLite database with ten thousand randomly-generated dummy entries at the click of a button. When I sent it to my partner over Skype and they…
Andrew Lau
  • 145
  • 12