petapoco Questions
6
Solved
What is the correct syntax for this query?
var l=db.Fetch<article>("SELECT * FROM articles WHERE title LIKE '%@0%'", 'something');
Or should I use CHARINDEX?
Tav asked 30/8, 2011 at 3:39
5
Solved
We are using PetaPoco as our data access tool for a SQL 2008 database. We have a problem when trying to insert/update a row on a table that has a trigger attached.
We are using PetaPoco's db.Save(...
Singletary asked 4/12, 2013 at 0:49
4
Solved
I am having a project in which I have my API classes and in that project I have generated the Database.cs. In my MVC project I have refenrenced the API. Uppon running the application I am having th...
Heribertoheringer asked 2/2, 2012 at 5:56
3
Solved
I am using Npgsql 3.0.3.0 and PetaPoco latest version.
When I run this command:
var dateCreated = DateTime.Now; // just an example
var sql = new Sql("WHERE date_created = @0", dateCreated.ToStri...
Parent asked 3/2, 2017 at 22:16
3
Solved
I want to be able to call a stored proc with named parameters in PetaPoco.
In order to call a stored proc that does a search/fetch:
Can I do something like this:
return db.Fetch<Customer>...
4
I have a stored procedure which returns back a table value.
Here is my stored procedure:
PROCEDURE [GetPermitPendingApproval]
@permitYear int = NULL,
AS
BEGIN
SELECT [p].[ID]
,[p].[PermitNum...
Salinas asked 21/11, 2013 at 16:41
9
I'm using the Save() method to insert or update records, but I would like to make it perform a bulk insert and bulk update with only one database hit. How do I do this?
Upthrust asked 6/7, 2011 at 10:44
5
Solved
I am trying to use Expression Trees and anonymous types to achieve the following.
Let's say I have this class:
class Person
{
public string FirstName {get;set;}
public string MiddleName {get;se...
3
Solved
PetaPoco has introduced Multi-POCO queries in experimental form (for now). As their blog post suggests and the code it provides this looks nice and all in One-to-One relations when we load multi PO...
Ard asked 20/5, 2011 at 11:0
5
Solved
I have a database table named Tags (Id, Name) from which I would like to select the ones where the name matches a name in a list. In SQL I would use something like:
Select * from Tags Where Name I...
2
Solved
To me, PetaPoco's Database.Fetch and Database.Query seem to be doing the same thing.
For example,
var db = new PetaPoco.Database("myDB");
ProductList products = db.Fetch<ProductList>("SELEC...
2
Solved
I've noticed a huge difference in how NPoco (or PetaPoco) works depending on which function you call when you are using LINQ.
For instance compare Fetch() which Query() which both appear to do th...
5
The PetaPoco.Database object implements IDisposable but I rarely if ever see code samples (including on PetaPoco's own website) that include a using statement as follows:
using (var db = new Datab...
Genevagenevan asked 30/10, 2015 at 20:28
3
Solved
I have a table with following columns:
ContractorId ......... INT ............. IDENTITY
ContractorName ........ Varchar(50) ....... P.K
ContractorGrade ....... Varchar(3) ....... P.K
The clas...
3
Solved
I started using PetaPOCO and Dapper and they both have their own limitations. But on the contrary, they are so lightning fast than Entity Framework that I tend to let go the limitations of it.
My ...
1
Solved
The code below seems to work using this:
var unitOfWorkProvider = new PetaPocoUnitOfWorkProvider();
var repository = new FakeRepository();
var fake = new Fake
{
// etc.
};
using (var uow = unit...
Huss asked 1/2, 2016 at 17:8
3
Solved
Using PetaPoco, you're allowed to do transaction management doing something like this:
var newObject = new NewObject();
var newObjectId = 1;
using (var scope = db.GetTransaction())
{
newObject = ...
Pelson asked 8/11, 2013 at 15:32
2
Solved
My Code:
string sql = "SELECT * FROM people where birthday >= @t1 AND birthday <= @t2"
DateTime t1 = DateTime.Parse("01-01-2000");
DateTime t2 = DateTime.Parse("01-01-2001");
var results = d...
4
Solved
I'm experimenting with PetaPoco to convert a table into POCOs.
In my table, I've got a column named TheEnum. The values in this column are strings that represent the following enum:
public enum M...
3
Solved
I am delighted by this:
// Insert a record with peta poco
var a = new Article();
a.title="My new article";
a.content="PetaPoco was here";
a.date_created=DateTime.UtcNow;
db.Insert(a);
I am dis...
2
Solved
NPoco seems to be a DLL that implments more advanced features of PetaPoco. PetaPoco installs code generation templates and PetaPoco.cs. The Nuget version of PetaPoco is 4.0.3. I know there are vers...
1
Solved
I have a PetaPoco class which defines a database table. It looks like this:
namespace MyProject.Pocos
{
[TableName("AdminNotification")]
[PrimaryKey("id", autoIncrement = true)]
[ExplicitColumn...
2
Solved
Is there a way to map the following to a Dictionary<int,int>? It seem it produces rows for as many returned results there are, but they have no values...
Sql sql = new Sql()
.Append("SELECT...
3
Solved
I have a table named Car
Table car ( id int NOT NULL, plate int NOT NULL, sent_to_server bit NOT NULL );
I want to select all Cars which are not sent to server yet
SELECT *
FROM car
WHERE se...
Reedy asked 27/2, 2014 at 10:56
1
Solved
My work recently starting using PetaPoco and although fantastic I missed the feature from Dapper which allowed multiple result grids from a single query to be processed into pocos.
As a result I w...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.