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

Asyncpoco issue - Datareader premature end of stream MySQL and c#

Is there a way to set the net_write_timeout when using AsyncPoco? I am getting a premature end of stream error from MySQL when using AsynchPoco processing a large recordset. The issue is described in here -…
0
votes
1 answer

Petapoco can't update with non primary key identity

I am using AspNetIdentity and I have a non primary key column that is an identity auto increment. [TableName("AspNetUsers")] [PrimaryKey("Id", autoIncrement = false)] public class Coach { public string Id { get; set; } public string Email {…
CGross
  • 493
  • 1
  • 7
  • 18
0
votes
1 answer

Assigning Private Property values

I'm testing out PetaPoco to determine if it meets our needs. I was under the impression that it would delve into my class and see the private properties that I've marked up as valid columns. Unfortunately, it's not behaving as expected. Can you…
Tyddlywink
  • 876
  • 7
  • 28
0
votes
1 answer

PetaPoco one-to-one relationship

I'm trying to figure out how to do a simple one-to-one relationship with PetaPoco in Umbraco 7. The ideal solution would be for my Peta object to contain a definition for another Peta model, which will be eager loaded when the object is…
Jonas m
  • 2,646
  • 3
  • 22
  • 43
0
votes
0 answers

Why didn't my Database.tt file generate POCO classes using PetaPoco?

I have a WebApi project that I have just started. I am trying to add a data access layer to it. I am using PetaPoco (I have a Models folder with a Generated sub-folder that has the .tt and .ttinclude files in it). However when I use 'Run Custom…
pariah
  • 1
  • 1
0
votes
1 answer

Table per Subclass Inheritance with PetaPoco / NPoco

I'm using version 2.6.88 of NPoco Micro-ORM. Lets say I have a class hierarchy like this: [NPoco.TableName("Person")] [NPoco.PrimaryKey("PersonID", AutoIncrement = false)] class Person { public Guid PersonID { get; set; } public String…
Robert Hegner
  • 9,014
  • 7
  • 62
  • 98
0
votes
1 answer

NPoco/Petapoco: Dataset too large for Fetch

I have some code which has to process through each record in a dataset, which I've retrieved from the database via List lp = Fetch("Select * from X"); My program crashes here with an out-of-memory exception. If I'd do it the…
erict
  • 1,394
  • 2
  • 14
  • 28
0
votes
2 answers

Petapoco repository pattern significant performance issues

We are using the petapoco repository pattern (similar to this blog post). As the page loads we open up the repository, run the query, dispose and then carry on processing. This is fine on light pages, but when this happens a few times in the page…
Paul
  • 9,409
  • 13
  • 64
  • 113
0
votes
1 answer

declaring a variable globally so that can be reused anywhere in c# mvc

I went through many links but couldn't find my answer.Links such as Global variables for setting configurations ASP.NET MVC , ASP.NET MVC C# global variable, ASP.NET MVC Global Variables and many more all of them suggest some complex methods like…
khushbu
  • 567
  • 2
  • 8
  • 24
0
votes
0 answers

how to use the table name dynamically for insert, update operations using petapoco

I have a situation where I need to dynamically give the name of table for which table is being updated. The table name some how I obtain.I want to do something like this. string tableName="Template"; dataContext.Update(tableName, "Id",…
khushbu
  • 567
  • 2
  • 8
  • 24
0
votes
2 answers

Why PetaPoco is not adding parameters to my query

I'm facing a problem in PetaPoco, and I can't figure it out. I'm using this code : var db = new OracleConnection(_connectionString); var query = Sql.Builder; query.Append("SELECT * FROM City WHERE ID = @0", 1); return…
Wassim AZIRAR
  • 10,823
  • 38
  • 121
  • 174
0
votes
0 answers

how to put the list data obtained from database to another variable in c# mvc using petapoco

I have obtained the list of data from database in the following way List mkckdata = new List(); var dataContext = new PetaPoco.Database("MessageEntity"); mkckdata =…
khushbu
  • 567
  • 2
  • 8
  • 24
0
votes
1 answer

Invalid model when using petapoco and editortemplates

I am using Petapoco (in Umbraco) to fetch an IEnumerable from the DB and pass it to the view. Code below abbreviated for easy overview Model: public class Account { [Column("accountId")] [PrimaryKeyColumn(AutoIncrement = true)] …
lape
  • 41
  • 6
0
votes
2 answers

Display value in Database DataContext

This is my Query => var department = dataContext.Query("SELECT Id FROM tblDepartment"); I want to display the values in variable Department in ViewBag or Anywhere.How can I do that?
Nivin V Joseph
  • 12,042
  • 2
  • 15
  • 24
0
votes
2 answers

Limit Value of a text field

I am new to MVC I have an Employee POCO like this [PetaPoco.TableName("tblEmployee")] [PetaPoco.PrimaryKey("EmployeeId")] public class Employee { public int EmployeeId { get; set; } public string Name { get; set; } public string Gender {…
Nivin V Joseph
  • 12,042
  • 2
  • 15
  • 24