Questions tagged [petapoco]
PetaPoco is a tiny and fast micro-ORM for .NET and Mono.
429
questions
0
votes
0
answers
8
views
How to automatically create model from database using PetaPoco library, step by step?
So this question has been asked before, and the most popular answer says installing petePOCO using the package manager console would automatically create folders (model>generated, etc.). It doesn't ...
0
votes
1
answer
71
views
Petapoco doing something when Update is performed
I have to perform some operation whenever the Upload() Petapoco method is called... The response could be to override it inheriting the Database class but unfortunately Upload() is private... Is there ...
0
votes
1
answer
74
views
Petapoco - Value cannot be null. Parameter name: key
While trying to use
_database.Delete(pocoObjects);
I get the error:
Value cannot be null. Parameter name: key
0
votes
1
answer
88
views
PetaPoco Fails to Pull Geography Records
I'm using C#, .NET framework 4.5 (with intentions to upgrade to .NET 5), and PetaPoco as my ORM.
I have a table named Jurisdiction with the following field definition:
CREATE Table [Jurisdiction]
......
-1
votes
1
answer
310
views
Procedure deleterecord has no parameters and arguments were supplied [duplicate]
I wrote a stored procedure for delete record in SQL server database
But I Can not send parameters with stored procedures.
This is my stored procedure:
ALTER PROCEDURE [dbo].[DeleteRecord]
AS
...
1
vote
1
answer
316
views
How to insert a PetaPoco object that has a property of another class (foreign key)?
To simplify and shorten my question, let's say that I have the following classes:
[TableName("persons")]
[PrimaryKey("person_id")]
public class Person {
[Column("...
1
vote
2
answers
126
views
Execure oracle procedure using PetaPoco
We use Oracle DB. We need to execute the following stored procedure, which has worked when we executed it directly on DB.
exec DWHCR.LANCEKING_PA.FORWARD_WF_PR(12345, 'WF_T02', 'Test123');
We tried ...
3
votes
1
answer
2k
views
Integrate PetaPoco v6 with asp.NET core
I am trying to use petapoco with my .NET core MVC application,
I have installed petapoco compiled as stated in another answer but don't know what to do next,
I searched many places but most of them ...
0
votes
1
answer
128
views
How to manipulate PetaPoco result set after fetch is complete?
I have created some classes to enable fetching data from multiple tables:
[PetaPoco.TableName("Employees")]
class Employee {
public int Id { get; set; }
public FirstName { get; set; }...
0
votes
1
answer
27
views
PetaPoco ajax 400 Bad Request on correct model type
I have a C# application that requests data from SSMS using a controller and PetaPoco as the ORM. It is work inherited from another developer but until this point has proven not difficult to work with. ...
1
vote
2
answers
211
views
PetaPoco request for int[] type not working
Hello I am trying to make a fetch to Microsoft SQL Server Management studio where in one of my columns there is an array of ints that I want to retrieve based on another column value.
I am making the ...
0
votes
0
answers
82
views
PetaPoco multi-table join with custom datafield
I used PetaPoco.Compiled 6.0.441...
I want to select data from two tables with inner join ...
always give me error msg
System.InvalidCastException: Object must implement IConvertible.
pls. help me ...
0
votes
1
answer
64
views
DNN MVC Module with Sql Hierarchy Id
Quick question here. Has anyone used the sql hierarchy id type in their dnn mvc module with peta poco? Do you need to write a custom query to cast the data type? Do you need to add sql server types to ...
1
vote
1
answer
396
views
Failed to read database schema
im newbie in c# and i want fetch data from mssql local engine with peta poco orm but i get this error
image of error im getting
and here is my connection string of my class library:
<...
0
votes
1
answer
268
views
Invalid operation. The Connection is closed error when using Petapoco FetchAsync
I am using the petapoco.compiled v6.0.441 in my MVC project. This is working fine for all the synchronous operations. But when I try to use the FetchAsync<> it is throwing an error 'Invalid ...
0
votes
1
answer
109
views
Binding for PetaPoco with Ninject
I need to bind a PetaPoco database object with Ninject. In the documentation (https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Fluent-Configuration) the following example is given for ...
0
votes
1
answer
117
views
Returning record ID's from PostgreSQL using PetaPoco
PetaPoco PostgreSQL 11.1
I am attempting to get a list of deleted record id's. This does NOT work:
var sql = new Sql()
.Append(@"; WITH _in (lastname, firstname, birthdate, description, ...
5
votes
1
answer
138
views
How to set auto incremented id to another column with using Peta Poco
I use C#, SQL Server and PetaPoco which auto increments the ID by default. I just want to know that if it is possible to set this autoincremented id to another column.
I have 2 more columns needs to ...
0
votes
1
answer
103
views
Casting double from petapoco sql request with MS Access decimal separator comma
I'm getting records from a MS Access database. The database decimal separator is comma and I can't change it.
The value from the SQL result casted into Double return wrong value as it's not the same ...
0
votes
0
answers
250
views
How to call oracle stored procedure using petapoco
We have recently changed from ADO to Peta Poco.
Connecting to SQL Server is quite easy and is getting familiar with it.
However, I can't find a way to connect to Oracle database.
These are the ...
0
votes
1
answer
212
views
Adding [ResultColumn] to Database.tt in PetaPoco
I am an avid user of PetaPoco. Is there any way to tweak the Database.tt (for generation of POCO's) to specify a ResultColumn in a specific table?
TIA
Currently, the Database.tt states:
// Tweak ...
1
vote
1
answer
394
views
NPOCO. Is it possible to insert nested objects?
I have a Dto class with two nested Dtos:
[TableName("ProductComponentVariant")]
public class ProductComponentVariantDto
{
[Column("Id")]
public int Id { get; set; }
[...
1
vote
0
answers
444
views
UnitOfWork exposed in service layer. Am i approaching this correctly?
I am currently working on a commerce extension thing, where i am not able to use dependency injection, and i have to keep packages to a minimum.
I am using PetaPoco as a micro orm.
I created a ...
1
vote
1
answer
887
views
how to get all records from one table and based on that each record fetch all records which associated to the first table records in mvc 5
I want to fetch all records from one table called Visitor and i have another table called booking_visitor
my visitor table
Visitor
VisitorId
VisitorName
Email
Phone
Photo
Booking_visitor
...
1
vote
1
answer
389
views
Petapoco paging sql view one to many
I am trying to create a search page via pagination for my search result.
Problem :
I have a table X. And this table have 20 one-to-many table relationship in my view(sql). For 1 row in my table X is ...
1
vote
1
answer
131
views
StaTypPocoQueries not working with PetaPoco fluent configuration
I'm testing PetaPoco as an alternative to Fluent NHibernate and I added the extension StaTypPocoQueries.PetaPoco to use lambda expressions to build queries, just like Fluent NHibernate.
I don't want ...
1
vote
2
answers
571
views
Failure to find table when using multiple schemas in PostgreSQL
WPF PostgreSQL 11.1
Npgsql.PostgresException: '42P01: relation "testme" does not exist'
When attempting to use a PostgreSQL database with multiple schemas, I have defined the following connection ...
0
votes
1
answer
329
views
How to filter database records based on static dropdownlist in mvc 5
i want to filter database record based on database column QtyRecieved,QtyRecievedand Void using static html dropdwonlist
QtyRecieved,QtyRecieved is decimal and void is boolean
here is what i have ...
2
votes
0
answers
266
views
PetaPOCO T4 Template, generate multiple files (one for each table)
I wanted to try PetaPOCO and I was reading a tutorial on how to use their T4 template, and from what I understood it will generate one file "Database.cs" which will include all classes/tables.
Is ...
1
vote
1
answer
109
views
Can AsyncPoco support multiple results sets?
This question shows that there is support for Multiple Results Sets from PetaPoco but I am using the asynchronous version (AsyncPoco) and I am unable to see such feature?
0
votes
1
answer
1k
views
How do I integrate a database into asp.net project using Postgresql and Petapoco?
I am not very good at setting up a project at all. I am working on an application in VS that uses ASP.NET with MVC framework. I am wanting to use a Postgresql database and use it in my project with ...
1
vote
1
answer
69
views
DNN DAL 2 Transactions Accross multiple Repositories
I have the following application design
Entities (Models)
Customer
Order
Repositories - Wrapper Around the DNN DAL2 Repository for CRUD
CustomerRepo
OrderRepo
How to implement Transaction support ...
0
votes
1
answer
332
views
In PetaPoco, how is it possible to define a table with 2 primary keys?
I saw on different forums that it's possible to define 2 primary keys for 1 table like this :
[PetaPoco.PrimaryKey("key1,key2")]
But When I try to do that :
db.SingleOrDefault<ObjectModel>(...
0
votes
0
answers
150
views
Petapoco cant find split point
Im getting an error i cant really understand. I have checked that the models correspond to the database tables but still i get an error that makes me think
System.InvalidOperationException: Couldn'...
0
votes
1
answer
54
views
Incorrect syntax near 'PETA_PAGED' added by peta poco .net pagination query
i am getting Incorrect syntax near 'PETA_PAGED' where i was using the tenantaware database to get the data from the data base and here is the query which i was using
select Id, Name from ListView ...
0
votes
3
answers
2k
views
How to convert date format in string using SQL query?
I am using ASP.NET MVC with petapoco. I want to display data from database table in the view as it has date column and I want to convert that date format in varchar like 'dd-mm-yyyy'.
My date column ...
0
votes
2
answers
1k
views
Batch insert data in table that has a parent child relationship
I am working on a function that would insert a data in a table that has a parent child relationship. My current implementation is to iterate the objects to insert them one by one. I am thinking of ...
-2
votes
1
answer
2k
views
Call stored procedure and don't wait for the response
I couldn't find any latest posts regarding this type of problems. So, asking this again.
I am using ASP.NET MVC, petapoco ORM to save the values to the database. Whenever I am saving the entity, I ...
1
vote
1
answer
298
views
PetaPoco {"Incorrect syntax near '@0'."} CTE
I am getting an error:
{"Incorrect syntax near '@0'."}
When I change the @0 to an integer i.e. 100, then I get an error:
{"Incorrect syntax near '*'."}
I am not sure what is happening. The CTE ...
1
vote
1
answer
224
views
Does PetaPoco support component mapping?
As I am new to PetaPoco and normaly user to NHIbernate I wonder if and how I can map components with petapoco.
Two classes:
[ExplicitColumns]
public class Event{
[Column]
public int Id {...
0
votes
1
answer
181
views
How to convert petapocohelper executereader to List [C#]
I'm developing .cs code to get data from a Stored Procedure and store it to a List but i'm having trouble getting all datasets to the List.
The SP:
ALTER PROCEDURE [_testSchm].[_test_sp]
@...
-2
votes
1
answer
269
views
@gmail not accepting while sql selection using petapoco
I have an SQL select statement as follows:
SELECT COUNT(*) FROM AUL_USERS WHERE EMAIL='entityframework@gmail.com' AND CUST_ID=1 AND TRASH=0
but it is throwing an error as:
Parameter '@gmail' ...
0
votes
1
answer
137
views
how to make DisplayName in MVC model?
while I was building MVC5 model with SQLite. the time span is tricky so I stored the tick instead. but then I get trouble on display name for it.
[PetaPoco.TableName("UserStatus")]
[PetaPoco....
0
votes
1
answer
2k
views
How to use SQLite with PetaPoco
I'm try to use PetaPoco with SQLite on MVC5. I created a model to make the mapping.
namespace LittleDemo.Models.UserModel
{
[PetaPoco.TableName("User")]
[PetaPoco.PrimaryKey("UserId", ...
-1
votes
1
answer
249
views
PetaPoco db.SingleOrDefault<T> passing in where name as well as value
I am trying to write a generic method to call DB records.
All works except to make the method useful I need to passing the WHERE name value too...as well as the value to match.
Something like this......
0
votes
1
answer
2k
views
(SQLite) Error: attempt to write to a readonly database
I have recently written a C# program whose functionality is to create and populate three tables in a SQLite database with ten thousand randomly-generated dummy entries at the click of a button. When I ...
1
vote
1
answer
295
views
Can I populate multiple tables from one poco?
I am investigating the use of an ORM to access our DataVault. Until now, PetaPoco looks most promising, but I am not bound to that one.
Most of the object we identify are embedded in a combination ...
2
votes
1
answer
1k
views
PetaPoco test for Existance
Looking through the documentation for PetaPoco
https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Querying-LINQ-Style
Specifically:
result = db.Exist<Person>("WHERE Id = @0", 12);
A ...
2
votes
1
answer
587
views
Petapoco tt file error
Getting this error when trying to save tt file in petapoco. I have installed petapoco from nuget package manager on a class library but it did not create the Auto generated Models folder as expected. ...
1
vote
1
answer
194
views
Query table columns by using 'desc tablename' command via PetaPoco
I want to get the columns info of a table in a Mysql database, and I use the micro-orm library PetaPoco. My code is as follows:
var cols=db.Query<dynamic>("desc t_sometable").ToList();
But it ...