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

petapoco shared connection

I am new to .net and this is my first project using c# winforms. for DAL i choose the petapoco. i go through the sample code of petapoco and i have some basic question where i get confused my project is multiuser desktop application and performance…
3
votes
1 answer

PetaPoco (DotNetNuke) and SQL - Adding an object with a List property or other composite object

I'm using a Data Access Layer based on PetaPoco (DotNetNuke 7.0). I've used it successfully when working with relatively simple objects but I now have to insert an object which contains at least one property which is a List of other objects. For…
user2025399
  • 121
  • 1
  • 13
3
votes
1 answer

How to use Npoco FetchOneToMany?

I am trying to use Npoco but running into some problems with FetchOneToMany I have a sql statement that joins 2 tables together and I output all the columns. [TableName("TableA")] [PrimaryKey("Id")] public class TableA { …
chobo2
  • 83,322
  • 195
  • 530
  • 832
3
votes
2 answers

Use a lot of stored procedures from C#

I'm looking at a project where the customer has a legacy database (MS SQL) with a lot of sps (around 250). I need to be able to talk to all of these from my C# project but trying to find a good way to generate as much of the plumbing as…
3
votes
2 answers

How do I make capitalization for table/column names not matter with PetaPoco and PostgreSQL?

My model looks like this... [PrimaryKey("TaskId")] public class Task { public int TaskId { get; set; } [StringLength(1000)] [DisplayName("What do you want to do?")] public string Description { get; set; } [DisplayName("When do…
Carter
  • 2,850
  • 9
  • 44
  • 57
3
votes
1 answer

Issue when insert into mysql using PetaPoco Database.Insert

I have a small project using PetaPoco to re-implement Membership Provider, Role Provider and Profile Provider of ASP.NET. And each table has two common field: name and lowered_name. And I face an issue when try to insert new record into database…
tumivn
  • 53
  • 1
  • 6
3
votes
3 answers

How to automatically create model from database using PetaPoco library?

I have a table in my database for which I want to create a model class with getters and setters. For most of the tasks in my project, I am using PetaPoco. I created models manually, but few tables have lots of columns. Is there any way to create a…
RKh
  • 13,818
  • 46
  • 152
  • 265
2
votes
1 answer

SQL records with completely identical datetime values

I have an Asp.net MVC application running on AppHarbor. It has the everyday email ordering process: User enters their email and submits it. System processes order and sends out email with a link. User checks email and clicks the link to do the next…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
2
votes
3 answers

PetaPoco not returning expected data

I have a BIT data type on one of my columns. I have written a query that does SELECT * FROM TABLE WHERE BITCOLUMN <> @0 It works fine if I pass in 1 or 0 but if I pass in 3 PetaPoco doesn't return the results I expect. Executing the SQL in a query…
Jon
  • 38,814
  • 81
  • 233
  • 382
2
votes
0 answers

PetaPoco - PostgreSQL interval and .NET Timepan conversion issues

I need help with an issue that I have run into while implementing interval columns in PostgreSQL. I am using a client application that is based on .NET. If create a Timespan object like so: TimeSpan startBalance = new TimeSpan(100, 0, 0); //100…
Allen
  • 21
  • 1
2
votes
2 answers

PetaPoco stored procedure error "Incorrect syntax near the keyword 'FROM'."}

I'm using C# with TSQL and SQL Server 2005 I'm trying to use PetaPoco to return a dataset as a list of objects. this is the code I'm using just now var s = PetaPoco.Sql.Builder.Append("USE [BI] EXEC [dbo].[TestProcedure2];"); var result…
2
votes
3 answers

How to map childs/parent class with petapoco?

I have these classes: class Car { int ID; string Name; } class Truck : Car { int MaximumLoad; } I have these tables Car - ID - Name Truck - CarID - MaximumLoad How could I map my classes with my table using PetaPoco ?
remi bourgarel
  • 9,231
  • 4
  • 40
  • 73
2
votes
1 answer

"Injecting" a WHERE clause dynamically w/ PetaPoco

I'm building a multi-tenant app with a shared database using .NET MVC 3 and PetaPoco. The tenant id (along with other info) is saved in a FormsAuth cookie on login and is available to all controllers via a BaseController property. Most tables,…
seekay
  • 2,493
  • 3
  • 27
  • 33
2
votes
3 answers

How to explicitly include mapped tables with PetaPoco

I want to use PetaPoco on a table that has circa 600 tables, but I only want to map a handful of the tables. Is there a way to explicitly state the tables I want mapping? The config in the t4 template (tables["tablename"].Ignore = true) doesn't…
Dan
  • 29,100
  • 43
  • 148
  • 207
2
votes
1 answer

PetaPoco fetch only retrieves totalCount but not items

Using PetaPoco, I am running a fetch similar to this: var result=db.Page
(1, 20, // <-- page number and items per page "SELECT * FROM articles WHERE category=@0 ORDER BY date_posted DESC", "coolstuff"); where article is defined as…
Kevin Le - Khnle
  • 10,579
  • 11
  • 54
  • 80