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
29
votes
5 answers

Ignore property on model property

How can I ignore a property on my model using dapper/dapper extensions/dapper rainbow or any of those dapper libraries?
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
12
votes
3 answers

Dapper insert into table that has a composite PK

I have a table that has a primary key composed of two columns, neither of which are auto-incrementing, and my Dapper insert (part of Dapper Extensions) is failing on the insert saying that the first of the two columns does not allow a null, even tho…
Ian Davis
  • 19,091
  • 30
  • 85
  • 133
11
votes
2 answers

DapperExtensions and Dapper.Contrib with non-dbo Schema

I'm using DapperExtensions v4.0.30319 and I'm trying to let Dapper.Contrib know that my schema is not DBO. I have provided: public class EngineMapper : ClassMapper { public EngineMapper() : base() { Schema("vehicles"); …
Developer Webs
  • 983
  • 9
  • 29
9
votes
1 answer

How do you register DapperExtension ClassMapper subclasses so they are used?

I've just started playing with DapperExtensions and it looks very promising. However, I'm confused on how to handle registering the ClassMapper subclasses. I have both a custom PluralizedAutoClassMapper and a regular ClassMapper and I'm trying to…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
9
votes
1 answer

dapper map one to one in classmapper

I have 2 simple tables. create table Owner ( Id int primary key, Name nvarchar(100), ); create table Status ( Id int primary key, BrandName nvarchar(50) OwnerId int foreign key references Owner(Id), ); In app I map these tables…
imodin
  • 821
  • 3
  • 12
  • 23
7
votes
1 answer

Dapper Extensions Change Schema

I am using Dapper Extensions to do some simple CRUD operations on a DB. My problem is that the tables I am using are held in a different schema to dbo. Is there a way to choose the schema at the dapper extensions level? or Should this be dealt with…
Mathew Padley
  • 102
  • 1
  • 8
6
votes
2 answers

How to log/get a SQL query auto-generated by Dapper Extensions?

I am using Dapper Extensions (DE) as ORM. It is consumed in Data Access Layer which is implemented using Repository pattern. SQL Express is back-end RDBMS. DE automatically generates most of the queries for me. I want to log those auto-generated…
Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
6
votes
2 answers

Dapper.SimpleCRUD Insert / Update / Get fails with message "Entity must have at least one [Key] property"

I'm a new baby in Dapper. Trying to incorporate CRUD operations with Dapper and Dapper.SimpleCRUD lib. Here is the sample code... My Data Model Looks like Class Product { public string prodId {get;set;} public string prodName {get;set;} public…
user2066540
  • 357
  • 2
  • 5
  • 16
6
votes
3 answers

How to ignore a class property using Dapper.net Extensions?

I am using Dapper.net Extensions and would like to ignore certain properties without having to write a complete custom mapper. As you can see in the ClassMapper below there is a lot of redundant code when all I really want to do is ignore one…
Greg Rogoszewski
  • 93
  • 1
  • 2
  • 6
5
votes
1 answer

How to Deal With Dapper return Key Value pair with Dynamic from LINQ

I am new to Dapper. Let me explain what i am trying to achieve. I have simple query which is returning columns from DB, i don't want to create Entity(Property) class for it to fill the data. I want to use Dynamic Type for this. Below is my…
Ram Singh
  • 6,664
  • 35
  • 100
  • 166
5
votes
1 answer

How to change the schema at runtime in Dapper-Extensions?

I am using Dapper Extensions but I have multiple schema names in My DB. I found the an answer in below link but it assumes that I have only one schema name and this is not my case. Dapper Extensions Change Schema What is the right way to change the…
Khaled Musaied
  • 2,513
  • 3
  • 25
  • 38
5
votes
1 answer

How do I bind underscore table/column names automatically using Dapper-Extensions?

I am naming my MYSQL tables and columns using underscore characters: this_is_a_table should map to: ThisIsATable this_is_a_column should map to: ThisIsAColumn Dapper can handle this mapping if i set: DefaultTypeMap.MatchNamesWithUnderscores =…
user1973285
5
votes
1 answer

dapper-extensions GetList() with (nolock)

Does anyone know if it's possible to tell dapper to append with (nolock) when using connection.GetList()? I am using this as the R from my CQRS model and it works well but I'm concerned now we're doing a bit more heavy reading that it will…
Beannie
  • 79
  • 1
  • 5
5
votes
1 answer

Using Dapper Extensions, can IDs be retrieved when inserting IEnumerable

If an object is inserted 1 at a time, then the Id can be fetched from the object: foreach (var object in objectList) { conn.Insert(object); int id = object.Id; // Returns Id as expected } However, if an IEnumerable of objects is inserted,…
Kevin Crowell
  • 10,082
  • 4
  • 35
  • 51
5
votes
3 answers

Do not update a certain property on Update method with dapper extensions

I know I can use the pure dapper to build my update string with only the properties I want to update (whitelist). What I want is to keep the ORM style of dapper extensions: con.Update(person); I want that some properties of person are not…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
1
2 3 4 5 6 7