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
0 answers

Hardcoded Query in PetaPoco ORM

We are planning to use PetaPoco in our project. As it is tiny ORM with performance benefit, one of the thing worried me a lot is hard coded queries. Due to that, whenever our column changes (added/removed), we have issue to find out same in all the…
Manish Pansiniya
  • 537
  • 4
  • 14
0
votes
1 answer

Each type implementing IDataItem must have associated string (an SQL select qry) but access needed before type instantiated

My application has a set of types implementing IDataItem. They are all simple "DTO" types representing database rows. Instances are created using PetaPoco (a micro ORM) by running a SQL select query against the database. The SQL select query is…
Laurence
  • 980
  • 12
  • 31
0
votes
1 answer

Referencing PetaPoco from App_Code class (Umbraco 7)

Trying to create a web service to use Petapoco, I have created the following in a cs file in App_code using System; using Umbraco.Core; using Umbraco.Core.Persistence; namespace utData{ public class MyDB{ public string demo(){ …
YesGenesisCamel
  • 173
  • 1
  • 12
0
votes
2 answers

Why there is no LastOrDefault method in petapoco like FirstOrDefault?

Let's say this is my table TicketUpdate in SQL Server with some data inside: _______________________________ | Id | TicketId | Description | ------------------------------- | 1 | 5 | desc1 | | 2 | 6 | desc2 | | 3 | 5 …
Shree Krishna
  • 8,474
  • 6
  • 40
  • 68
0
votes
1 answer

connecting different database using petapoco

we are using petapoco mini ORM which have inline queries use to connect to PostgreSQL database. public async Task> FetchExistP(CQ c) { var query = "select * from \"P\"where \"Pr\"= " + c.M; var database = …
0
votes
0 answers

How to load a database provider in a separate assembly than my web application?

I tried to access a PostgreSQL database using PetaPoco but i got this exception : "Could not load the PostgreSQLDatabaseProvider DbProviderFactory." The problem is linked to the fact that the database access is done in a different assembly than my…
Spilarix
  • 1,418
  • 1
  • 13
  • 24
0
votes
1 answer

Petapoco - invoke stored procedure with several output parameters

This code works fine: var unitOfWorkProvider = new PetaPocoUnitOfWorkProvider(); using (var uow = unitOfWorkProvider.GetUnitOfWork("SomeConnectionString")) { var errorNumber = new SqlParameter("@ErrorNumber", SqlDbType.Int) { Direction =…
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
3 answers

Using PetaPoco in Asp.NET Core MVC 6

so i started trying out the new ASP.NET 5 Platform and have the following dependencies in my Project.json "dependencies": { "System.Collections": "4.0.10-beta-23019", "System.Linq": "4.0.0-beta-23019", "System.Threading":…
Paul Plato
  • 1,471
  • 6
  • 28
  • 36
0
votes
2 answers

Executing Oracle function and getting back a return value

I am using NPoco ORM and trying to get a result from Oracle function. I have tried: public string GetData(int param1, int param2) { var command = "PKG_SOMEPACKAGE.SET_DATA( @p_param1, @p_param2);"; var sql =…
Alex Art.
  • 8,711
  • 3
  • 29
  • 47
0
votes
1 answer

Repository Pattern with NPoco, Worth it?

I am considering NPoco for a large business application. I am a bit concerned that is it worth to develop a repository pattern? I will need to handle complex SQL statements and extensive database operations on several entities in a same use case.…
ak1
  • 387
  • 7
  • 20
0
votes
1 answer

Sql warning message retrieve using peta poco ORM

We have feature that create tables dynamically, While creating table I am getting following warning message: Warning: The table "@@workingData" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or…
gurunath
  • 1
  • 2
0
votes
1 answer

Generic FetchDictionary method for petapoco

PetaPoco has this method : public List Fetch(string sql, params object[] args) { return Query(sql, args).ToList(); } I want to create a method like this : public Dictionary FetchDict(string sql, params…
MD Luffy
  • 536
  • 6
  • 18
0
votes
1 answer

Send Type through AJAX to C# method requiring generic type

I have a generic method. I do not know what the type will be at the time of writing this function. It will change based on application which is why I need it to return generic. I would just return a json string, however I am using petapocos which…
Taylor Mitchell
  • 614
  • 11
  • 27
0
votes
1 answer

Umbraco + Petapoco - Stored procedure to temp table

Evening, I'm trying to exec a stored procedure into a temporary table so I can join some bits from another table. Obviously the ideal solution would be to add the join into the stored procedure however this is currently not an option. Here's what…
Danny
  • 242
  • 2
  • 12
0
votes
1 answer

Incorrect syntax near 'b'

I am facing an error while a query is executed: Incorrect syntax near 'b' Code: using(var db = new GnpCoreDatabase()) { var basket = db.Query ("select p.product_tax,c.shipping_cost FROM dbo.Basket b join…
Mohsin
  • 902
  • 3
  • 23
  • 49