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

mvc4 PetaPoco like query throwing exception

I am using petapoco. and making search query with like please let me know there is right query or not? var context = new PetaPoco.Database(Connection.connectionstring); SqlQuery = @"SELECT MenuId, MenuTitle, OrderNumber,…
dotnetexpert
  • 145
  • 2
  • 16
0
votes
1 answer

error in running transformation:indexoutofrangeexception - petapeco

as per suggestion for by @CreativeManix I started investigating petaPeco Retrieving large number of rows (more than 10 mil) in asp.net mvc application After adding exact system.data.oracleclient + putting web.config in the bin where mvc is getting…
kulNinja
  • 526
  • 6
  • 14
0
votes
1 answer

PetaPoco paging with sql+parameter not working

I'm facing a very odd issue with PetaPoco while trying to return a paged query (SQL Server) with sql string + parameter. If I just use a plain SQL string it returns the resulsets as expected. If I use the string with @0 parameter no resulset is…
Manight
  • 500
  • 5
  • 26
0
votes
1 answer

how to use the stored procs using petapoco

I have created a stored procedure in data base. var db = new PetaPoco.Database("connection name"); return db.Query("exec spstp"); I declared a spppoco.cs in models with the column names I used in stored procedure public class…
kvs
  • 466
  • 1
  • 10
  • 24
0
votes
1 answer

Access database using petapoco and XML EXPLICIT

I have this SQL Server query that uses XML Explicit SELECT 1 AS Tag, NULL AS Parent, NULL AS 'Agents!1!' FOR XML EXPLICIT I need use petapoco to obtains this results... can I make this? Thanks,
Victor Sanchez
  • 583
  • 9
  • 28
0
votes
2 answers

Can PetaPoco populate an object using a stored procedure with a join clause?

I have a stored procedure that does something similar to: SELECT a.TaskId, b.CompanyCode FROM task a JOIN company b ON b.CompanyId = a.CompanyId; I have an object called TaskItem that has the TaskId and CompanyCode properties, but when I execute…
Mark Kadlec
  • 8,036
  • 17
  • 60
  • 96
0
votes
1 answer

PetaPoco doesn't return results when ordering by NEWID()

I'm using the brilliant PetaPoco as my ORM for a small WCF service. I have a small method that gets 5 random records from SQL: public IEnumerable GetRandomStock(int number) { Database db = new Database("MyCS"); var sql =…
Brett
  • 1,923
  • 3
  • 18
  • 24
0
votes
1 answer

Fail to Insert Unicode into SQL Server using Peta Poco

Normally when we want to insert unicode letter into SQL Server, we can do N' foreign letter' But I'm using Peta Poco and I cannot add N (or I don't know how to) So how do I make sure my input can be saved as unicode (my table columns are nvarchar) ?
Hami
  • 335
  • 1
  • 7
  • 22
0
votes
1 answer

exclude member while using Fetch in Petapoco

Thinking of trying to use Petapoco.Fetch where member "content" is an c# object. "Content" member is byte[] member which I store in cache og want to retrieve specially .. not from database. So: SQL = "select *…
aghaux
  • 729
  • 4
  • 14
  • 38
0
votes
2 answers

PetaPoco not seeing class attributes

For some reason when I set up attributes on a Poco class for tablename and primary key PetaPoco is not seeing them and defaulting to ID autoIncrement = false [TableName("MyTableName")] [PrimaryKey("Id", autoIncrement = true)] public class MyClass { …
Ken Burkhardt
  • 3,528
  • 6
  • 33
  • 45
0
votes
1 answer

Petapoco update datetime error

I was trying to update a few datetime field using Petapoco, but the update always fail so I look up my SQL profiler and found the following execution statement. exec sp_executesql N'UPDATE [db_Product] SET [aName] = @0, [aDesc] = @1, [EmpID] =…
Hami
  • 335
  • 1
  • 7
  • 22
0
votes
2 answers

PetaPoco Output Param From Stored Procedure not returning

Using SQL Server 2005 w/ latest PetaPoco w/ the following code: Dim count = New SqlParameter("@Count", System.Data.ParameterDirection.Output) count.DbType = Data.DbType.Int32 Dim results = db.Query(Of User)(";exec SearchUserPaged…
bbqchickenrobot
  • 3,592
  • 3
  • 45
  • 67
0
votes
1 answer

Composite primary keys with PetaPoco for Exists and GetById methods

I found this nice branch of PetaPoco by schootime which handles composite primary keys. Now what I didn't find is how he handled in his version of PetaPoco methods which require a primary key, with composite keys like for example db.Exists and…
Manight
  • 500
  • 5
  • 26
0
votes
1 answer

PetaPoco.relation extensions fetch many-to-one gives me unwanted children by default

I have for example two tables like: CREATE TABLE [dbo].[Parent]( [Id] [int] NOT NULL, [Name] [nvarchar](50) NOT NULL ) ON [PRIMARY] GO BEGIN TRANSACTION; INSERT INTO [dbo].[Parent]([Id], [Name]) SELECT 1, N'First parent' UNION ALL SELECT…
John
  • 2,043
  • 5
  • 28
  • 49
0
votes
1 answer

Multiple Queries with PetaPoco /NPoco?

Say I have these 2 tables/domains [TableName("TableA")] [PrimaryKey("TableAId")] public class TableA { public int TableAId { get; set; } public string City { get; set; } public TableB TableB { get; set; } …
chobo2
  • 83,322
  • 195
  • 530
  • 832