Questions tagged [dapper-extensions]

Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Create, Read, Update, Delete) for your POCOs.

Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Create, Read, Update, Delete) for your POCOs. For more advanced querying scenarios, Dapper Extensions provides a predicate system. The goal of this library is to keep your POCOs pure by not requiring any attributes or base class inheritance.

Customized mappings are achieved through ClassMapper.

Important: This library is a separate effort from Dapper.Contrib (a sub-system of the Dapper project).

Features:

  • Zero configuration out of the box.
  • Automatic mapping of POCOs for Get, Insert, Update, and Delete operations.
  • GetList, Count methods for more advanced scenarios.
  • GetPage for returning paged result sets.
  • Automatic support for Guid and Integer primary keys (Includes manual support for other key types).
  • Pure POCOs through use of ClassMapper (Attribute Free!).
  • Customized entity-table mapping through the use of ClassMapper.
  • Composite Primary Key support.
  • Singular and Pluralized table name support (Singular by default).
  • Easy-to-use Predicate System for more advanced scenarios.
  • Properly escapes table/column names in generated SQL (Ex: SELECT [FirstName] FROM [Users] WHERE [Users].[UserId] = @UserId_0)
  • Unit test coverage (150+ Unit Tests).

Source: tmsmith/Dapper-Extensions

98 questions
1
vote
2 answers

How to setup Dapper Extensions custom mapping with Structuremap?

I am using Dapper Extensions for building my repositories in an MVC app that is configured to use Structuremap. For one of the Models, I need to create a custom mapping to ignore a field. public class ServiceMapper : ClassMapper { …
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47
1
vote
2 answers

Dapper can't ignore nested objects for parameter?

I am beginning to use Dapper and love it so far. However as i venture further into complexity, i have ran into a big issue with it. The fact that you can pass an entire custom object as a parameter is great. However, when i add another custom object…
user1732364
  • 925
  • 4
  • 28
  • 58
1
vote
1 answer

Map SQL to class in Dapper

My problem: When using this extension it only maps up the ID value from the database to class object. So I'm curious how do i make it map the other values? C# Mapper public class SoftwareReleaseTypeHandle : SqlMapper.TypeHandler
EKS
  • 5,543
  • 6
  • 44
  • 60
1
vote
2 answers

System.Data.SqlClient.SqlException Thrown by Dapper When Query Result Has More Than 1000 Records

The method call below fails with the message "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.": public IEnumerable GetResults(SqlConnection connection, string attribute) { var…
Scott Lawrence
  • 6,993
  • 12
  • 46
  • 64
1
vote
2 answers

Dapper.Tvp Assembly is does not have a strong Name

Recently I was working with Dapper.Net and it is awesome so far for dynamic object manipulations with sql, Great work by Dapper team. But there is a need to have bulk insert and update and i used table valued parameter which is better in terms of…
1
vote
1 answer

How do you include an object that has a generic list property and a reference type property in dapper?

my class is: public class Person { public int Id { get; set; } public string Name { get; set; } public List
Addresses { get; set; } public BankAccount Account { get; set; } } public class Address { public string Street…
John Patrick Po
  • 169
  • 1
  • 9
1
vote
1 answer

How to Update an array with Dapper Extension?

I get from DB my entities' list, change some properties and try to Update in in DB. using (var cn = new SqlConnection(ConnectionString)) { cn.Open(); var dataPredicate = Predicates.Field(f => f.Id, Operator.Eq, new [] {1, 2, 3}); // of course…
lyha
  • 517
  • 4
  • 7
1
vote
1 answer

Map SQL columns in SqlMapper.Query to class properties

First I do not have much experience with dapper.net and maybe this problem has simple solution. I would like use multi mapping features. I simplified my problem. I have 2 tables. First table CARS Columns: CARD_ID…
1
vote
3 answers

Why can't I set "this" to a value in C#?

I am using Dapper.net Extensions and I would like to be able to retrieve a Photo object and set 'this' to it without having to set each property individually. What would be the best way to accomplish this? In the code below it says I cannot assign…
Greg Rogoszewski
  • 93
  • 1
  • 2
  • 6
1
vote
0 answers

Executing an Update with DapperExtensions fails when the data type has TimeSpan property

I have the following piece of code (example simplified a bit): public class Entity { public int Id { get; set; } public TimeSpan Duration { get; set; } ... } ... public void Save(Entity e) { if (e.Id == 0) …
Pete
  • 12,206
  • 8
  • 54
  • 70
0
votes
1 answer

Dapper Extension Class Mapper

Table -1 Create Table GuestMessageDetails( id bigint primary key identity(1,1), companyname varchar(250), FirstName varchar(250), FamilyName varchar(250), EmialAdress varchar(250), Telephone bigint, Country …
0
votes
1 answer

Dapper Extension LIKE operator returning results in reverse order while matching string

I am using Dapper Extension method GetByPredicate and passing the predicate value with Like operator. Predicates.Field(row => row, Operator.Like, $"%{string}%") But while matching the string pattern it is returning results in reverse order,…
0
votes
1 answer

How to implement “NOT IN” clause with Dapper Extensions Predicate?

I found how to implement IN clause using Dapper Extensions here. Now, I want to implement NOT IN clause. So, I am expecting SQL query something like below: SELECT * FROM MyTable WHERE MyField NOT IN (param1, param2) But I could not find anything…
Andy
  • 35
  • 3
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

Is there a way to include a single child table when Bulk Insert'ing from EF context?

We have a huge EF context model. I want to bulk insert data from one parent table and its child table only. BulkSaveChanges is taking too long and I'm playing with BulkInsert but when I set options.IncludeGraph = true then it is taking even longer.…
LINQ2Vodka
  • 2,996
  • 2
  • 27
  • 47