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
1 answer

Dapper GetList vs Query Method with the different performance

In order to support the popular database, such as sqlserver, oracle and mysql, we changed the raw sql conditoin Query() method to GetList() method which are from the DapperExtension, but there will be a performance issue when using GetList(), it…
Bes Ley
  • 1,685
  • 1
  • 20
  • 39
1
vote
1 answer

How to write 'Not Equal' clause in Dapper Extension?

I want to create below SQL query in dapper extentions. SELECT DISTINCT Description FROM tblPeople WHERE ID = 2 AND (AddressTown IS NOT NULL AND AddressTown<>'') ORDER BY Description ; I have tried so far: PredicateGroup pgMain = new PredicateGroup…
1
vote
1 answer

Dapper InsertAsync not inserting records

Here is the top of the POCO I am using to create an object to install into my database table called "LOCITEMS": [Table ("LOCITEMS")] public class LOCITEMS :ICloneable { [ExplicitKey] public string LOCATIONID { get; set; } public string…
john
  • 1,273
  • 3
  • 16
  • 41
1
vote
1 answer

Dapper Extensions custom ClassMapper isn't called on Insert()

I'm using Dapper Extensions and have defined my own custom mapper to deal with entities with composite keys. public class MyClassMapper : ClassMapper where T : class { public MyClassMapper() { // Manage unmappable…
1
vote
1 answer

Get the count of resultsets returned from dapper.QueryMultiple Method

I use Dapper library. I have a dynamic query which returns one or more resultsets/tables from QueryMultiple Method. I don't have any specific count of resultsets to write no. of Read() method. Do we have any function or method (e.g. result.Count =…
SanketS
  • 963
  • 1
  • 13
  • 36
1
vote
1 answer

Models.Student' does not contain a definition for 'Score'

I have TWO tables. My primary table is called Student, secondary table is Marks. Dapper is new for me. This is my code: s_id is the primary key in the Student table and is foreign key in Marks table (student (parent) – marks(child)). Controller:…
shashi
  • 37
  • 7
1
vote
2 answers

How to fix DapperExtensions error after I Insert data and get the returned id

I use Dapper-Extentions to pull and push data to database I use unsigned int id as my Primary key in database and in the class as well. my class looks like this public class Product { [Column("id")] public uint Id { get; set; } } My Mapper…
YouneS
  • 390
  • 4
  • 10
1
vote
1 answer

Delete multiple objects with a single query (or in transaction)

I'm using Dapper with Dapper-Extensions. I'm currently deleting all the objects one-by-one: dbConnection.Delete(data); This is bad not only for performance, but also because if a delete fails I would like to rollback the entire operation. Is…
ufo
  • 674
  • 2
  • 12
  • 35
1
vote
2 answers

TransactionScope with DapperExtensions?

I want to group multiple method calls involving DapperExtensions functions under a single Transaction, so that I can roll all of them back if any one fails. This involves calls to pre-existing functions, some of which use DapperExtensions…
Query
  • 123
  • 1
  • 9
1
vote
2 answers

DapperExtensions Generic Populate Model using Predicates from SeparateModels

I am working on a project that utilizes Dapper, DapperExtensions using Generic Models and I am wondering how I can populate a model using the DapperExtension.GetAll method? Below is the sql code that returns the records I am trying to filter on…
ondrovic
  • 1,105
  • 2
  • 23
  • 40
1
vote
2 answers

Create a DbContext that handle a DatabaseFactory to use DapperExtensions more easily

This days I try to create an abstract base repository using some basic CRUD functions proposed by DapperExtensions. But the code given as an exemple use a SqlConnection which is made to connect to a SQL Server database. I want to be able to connect…
Hans
  • 382
  • 1
  • 4
  • 17
1
vote
1 answer

Using Dapper to Insert into a Table with Default Values

I have a table that has a field that is not null and has a default value defined [CreatedOn] not null default(getdate()) The the property I use in the model for dapper is a nullable DateTime public DateTime? CreatedOn { get; set; } If I try to…
QueueHammer
  • 10,515
  • 12
  • 67
  • 91
1
vote
1 answer

Case insensitive comparison in DapperExtensions predicate

I'm trying to do a case insenstive match against a MySQL table while using Dapper Extensions, but I'm getting a null exception on the field name when trying to make it UpperCase within the linq expression: Here's the code: var…
codenewbie
  • 181
  • 16
1
vote
1 answer

Dapper Extension: class with composite fields, mapped to an individual table

I have the following classes: public class Publication { public int Id { get; set; } public string Title { get; set; } public string Headline { get; set; } public DateTime Published { get; set; } public ProductContact Contact {…
ggimenez
  • 65
  • 1
  • 9
1
vote
2 answers

Incorrect Syntax near keyword "From"

I have this custom repo and when I try execute a query, it returns an exception If I execute the query using sql string, it does not return an error, but when I use some extention then I have this exception. Like this: public override…
Jedi31
  • 735
  • 1
  • 6
  • 22