Questions tagged [dapper-contrib]

Dapper.Contrib contains a number of helper methods for inserting, getting, updating and deleting records.

Dapper.Contrib contains a number of helper methods for inserting, getting, updating and deleting records.

Source: https://github.com/StackExchange/dapper-dot-net/tree/master/Dapper.Contrib

47 questions
0
votes
1 answer

Npgsql enum mapping

I'm using Dapper 2.0.123, Dapper.Contrib 2.0.78 and Npgsql 6.0.4 in ASP.Net API (.Net 6) project. Table in Postgres database has column status defined as campaigns_status_enum. Class and its enum looks like this: [Table("campaigns")] public class…
nighthawk
  • 773
  • 7
  • 30
0
votes
2 answers

Npgsql.PostgresException 42703: column "Created" of relation "posts" does not exist

Currently I'm working on a little project with .NET Core and PostgreSQL. For my data acccess, I would like to use Dapper.Contrib. Right now, I'm facing the following problem: The following snippet shows the CREATE_DATABASE.sql CREATE EXTENSION IF…
MarcoB
  • 51
  • 2
  • 6
0
votes
2 answers

How do I use Dapper.Contrib with FluentMap to update an entity with an identity column?

I have a class called Business, which has a property Id that is a identity field in MS SQL Server database. When I do an INSERT, it works properly. If I do the following: _db.Update(business); I get an error: invalid column name 'id" the column in…
Maccurt
  • 12,655
  • 7
  • 32
  • 43
0
votes
2 answers

How to use Dapper LINQ with TableDirect (without embedded SQL) with ORACLE?

I tried DapperExtensions, Dapper.Extensions.Linq and linq2dapper to no avail. I will try Dapper.SimpleCRUD-with-Oracle. I will probably settle with a Stored Procedure instead. I want to use TableDirect with no embedded SQL statement. How can I use…
kblau
  • 2,094
  • 1
  • 8
  • 20
0
votes
1 answer

Dapper ignore property runtime

Is there a way to ignore property from being mapped in runtime. Because I don't know if database has specific column and I have to check it before doing insert. If database doesn't have column then I want to ignore this one specific…
user2412672
  • 1,459
  • 3
  • 20
  • 36
0
votes
2 answers

Accessing a single field in a foreach using Linq Dapper

I am using dapper and I want to use Linq to be able to update a single field called status in one table I am trying to use. public async Task ProcessUnprocessedTransactions(IEnumerable items) { …
c-sharp-and-swiftui-devni
  • 3,743
  • 4
  • 39
  • 100
0
votes
1 answer

Dapper with MySQL and ASP.NET CORE 2 - Insert Model Fails

I'm using ASP.NET CORE 2 with MySQL 5.6.27, Dapper 1.50.2 and Dapper.Contrib 1.50.0. I'm getting an error while trying to perform basic insert operation using model, however if I use plain INSERT INTO SQL query, the operation is successful. This is…
Arayn
  • 986
  • 1
  • 16
  • 24
0
votes
1 answer

Dapper.Contrib Support for composite primary key

Hy people, I have a short question to ask: is there any support for composite primary keys in Dapper.Contrib, and if not, dose anyone have an implementation i can use? Thank you !
zoran djipanov
  • 115
  • 1
  • 1
  • 9
0
votes
1 answer

Use Dapper.Contrib with inheritance

When trying to use Contrib's CRUD methods in an object where the properties are in an inherited object I get an Entity must have at least one [Key] or [ExplicitKey] property error. Here is a simplified version of my objects: public class…
adinas
  • 4,150
  • 3
  • 37
  • 47
0
votes
1 answer

How do I access child object fields from a parent object in C#?

I am using Dapper.net as an ORM. I have an abstraact class called BusinessObject, which is inherited from by other classes that represent the tables in my database, for example SubContractorJob. I have a method on the BusinessObject class called…
dpberry178
  • 558
  • 6
  • 21
0
votes
2 answers

Insert enum as string using Dapper.Contrib

I've just started using Dapper.Contrib to help me with inserts and gets but since my enums are stored as strings in the database (for several reasons) I'm having trouble with inserts. Dapper works seamlessly with string enums when reading, but…
Loudenvier
  • 8,362
  • 6
  • 45
  • 66
0
votes
1 answer

Dapper.contrib Insert - Cannot apply indexing with [] to an expression of type 'object'

Using: .NET Core 1.1 Dapper.Contrib Npgsql On Postgresql 9.6 I am trying to use .InsertAsync extension method but getting error: Cannot apply indexing with [] to an expression of type 'object' Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:…
stkxchng
  • 65
  • 5
  • 26
0
votes
1 answer

Dapper.Contrib - how to get change tracking values?

I'm working on a .Net project using Dapper as the ORM. EF is not really an option as we need the DB/schema to be somewhat flexible at runtime. Using Dapper.Contrib we can use the 'change tracking' feature to optimise what gets written to the…
Phil S
  • 642
  • 8
  • 19
-1
votes
1 answer

Dapper, Insert record in SQLite table

I am trying to insert a record in a SQLite table, but the first fields stays NULL. First I created a table in Ssqlite: CREATE TABLE Tests(id INTEGER, nr INTEGER); Then I wrote this code (Target Framework: .NET 6.0): using…
Luuk
  • 12,245
  • 5
  • 22
  • 33
-1
votes
1 answer

Dapper contrib get data having varchar primary key

I have a varchar key column. I am trying to use the Get method of Dapper contrib. I get an exception: Get only supports an entity with a [Key] or an [ExplicitKey] property. My Entity: public class State : BaseModel { [Key] public…
ros2008
  • 21
  • 7