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

c# Dapper, SplitOn: multiple same parameter issue Multi-mapping one-to-many

I have an issue were Dapper Query splits on the parent object and not the child object. The result gives back one parent row per child, giving many duplicate parents with only 1 child in them. One possible issue im exploring is if the primary key…
4
votes
1 answer

Is there a way to map properties to column names using some .Insert extension method for Dapper?

I have the following challenge with this class: Public Class MyClass Property Id As Integer Property LastName as String End Class The corresponding data table in the database has as fields: Id (int, not null) Last-Name…
Dabblernl
  • 15,831
  • 18
  • 96
  • 148
4
votes
1 answer

Dapper QueryMultiple Stored Procedures w/o mapping to Objects

With dapper, I can do batch execute for Stored Procedures, something similar to: connection.Execute(@" exec sp1 @i = @one, @y = @two exec sp2 @i = @three", new { one = 1, two = 2, three = 3 }); However, the only means of retrieving data that…
Bill
  • 2,026
  • 9
  • 55
  • 99
3
votes
1 answer

Dapper with Oracle give ORA-00936: missing expression error

I am using Dapper, with Dapper.Extensions and Dapper.SimpleCRUD. The following code works fine when running against a MYSQL database. However when I run the same code with the same tables against oracle I get ORA-00936: missing expression error. …
Weston Goodwin
  • 781
  • 3
  • 12
3
votes
2 answers

How to use Char and VarBinary in Dapper?

I have to call Stored Procedure in which parameters are char and VarBinary(MAX). I need to call this stored procedure from C# code using Dapper. But I am not able to find any parameter supported by dapper. SP: ALTER PROCEDURE [dbo].[uspTest] …
Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
3
votes
1 answer

How to insert an object into PostGreSql using Dapper Extensions without specifying primary key explicitly?

When I want to insert an object into my database, I receive an error: object reference not set to an instance of an object when the primary key field for the object is null. When I set some value to the field, it works fine. My table creation…
WynDiesel
  • 1,104
  • 7
  • 38
3
votes
1 answer

How to map Dapper Extensions to multiple databases?

I could not find an example online where they showed you how to create mappings to multiple databases (in same application) based on which Unit Of Work you are using. Seems like Dapper Extensions will accept only one global SqlDialect. I want to use…
BugCatcherJoe
  • 487
  • 3
  • 17
3
votes
1 answer

Ignore a property only on Update with Dapper?

Setup As part of my data access layer, I am using Dapper with DapperExtensions and representing my database entities with models. Some of these models contain fields used for logging or change tracking, like so: public class ExampleClass :…
Query
  • 123
  • 1
  • 9
3
votes
2 answers

Dapper returns SQL conversion error on ID column

In my database I have an ID column that is a nvarchar type because it contains unique user names. In my .Net MVC application I am using Dapper to handle the database exchange. I then use the DapperExtensions.Get(dynamic id) on my models to grab a…
Joe Higley
  • 1,762
  • 3
  • 20
  • 33
3
votes
1 answer

Unable to insert file stream into SQL filetable using Dapper.NET

I am using Dapper.NET as ORM layer in my project. I am trying to write WebApis for file upload and download. However I am not able to get it working. I have already searched enough to look for help but I couldn't find any. If I was simply using…
Rajiv
  • 1,426
  • 14
  • 21
3
votes
2 answers

DapperExtensions: Add "insert ... update on duplicate key"

Now I'm using Dapper + Dapper.Extensions. And yes, it's easy and awesome. But I faced with a problem: Dapper.Extensions has only Insert command and not InsertUpdateOnDUplicateKey. I want to add such method but I don't see good way to do it: I want…
mtkachenko
  • 5,389
  • 9
  • 38
  • 68
3
votes
1 answer

Token based authentication using Dapper micro-orm

I am looking for tutorial or sample for Dapper using token based authentication in web api 2. I appreciate if anyone can suggest where to start, I have found tutorial in…
jake talledo
  • 610
  • 11
  • 24
2
votes
1 answer

How to specify a Schema while mapping with DapperExtensions?

I'm trying to get all records from SQL database using DapperExtensions. But I have a Schema set to other than dbo for some tables. Hence, the table is not recognized from sql query. For example, a table is in the form [Schema][TableName]. But when I…
veli
  • 249
  • 1
  • 5
  • 14
2
votes
1 answer

MySQL + Dapper Extensions: Error in SQL syntax

I am trying to do CRUD operations using Dapper Extensions. But I am getting error while inserting data to MySQL database as follows: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the…
t. YILMAZ
  • 229
  • 5
  • 19
2
votes
2 answers

How to implement "IN" clause with Dapper Extensions Predicate?

I want to replace this query using Dapper Extensions Predicate? SELECT * FROM SomeTable WHERE id IN (commaSeparatedListOfIDs) The commaSeparatedListOfIDs is an IEnumerable of Integer. What I have tried so far: using (SqlConnection cn = new…
DanielGatti
  • 653
  • 8
  • 21