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

Fill class object using Dapper

public class Expenses { public Category Category { get; set; } public PaymentModes PaymentModes { get; set; } } public class Category { public int CategoryID { get; set; } public string CategoryName { get; set; } } public class…
Arpit
  • 65
  • 1
  • 10
0
votes
1 answer

How to get table name from POCO with Dapper Extensions mappings?

I have a table with name MyTable in my database. A POCO class MyTablePoco is created for that table. Following is Mapping code of Dapper Extensions: class MyTableMapper : ClassMapper { public MyTableMapper() { …
Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
0
votes
1 answer

Exception with message 'No columns were mapped' using Dapper Extensions

I have a class which implements some interface: public interface IDb {} public class DbModel : IDb {} After this I use Dapper Extensions to insert the object into the DB. This code works well: var obj = new DbModel(); sqlConnection.Insert(obj);…
giokoguashvili
  • 2,013
  • 3
  • 18
  • 37
0
votes
1 answer

Dapper Extensions dbConnection.Get
Problem with: Dapper Extensions dbConnection.Get(personId) I have a model called Person: Person { public int PersonId { get; set; } public string Name { get; set; } } In the database I have this table: data.Persons Pers_Id …
0
votes
4 answers

Visual Studio not resolving Dapper.Extension Namespace

I am trying to learn how to use Dapper.Extension but after multiple attempts installing and reinstalling the nuget package. I can't get the namespace to resolve and usable. I am creating a generic repository but when i attempt to include the…
user1732364
  • 925
  • 4
  • 28
  • 58
0
votes
1 answer

Adding multiple maps when using dapper extensions

I am using dapper extensions and have a question about the class mapper. Unfortunately most of my tables need some mapping done to them such as different schemas etc. So I find I am typically doing a lot of swapping out the DefaultMapper as per…
TheEdge
  • 9,291
  • 15
  • 67
  • 135
0
votes
1 answer

Dapper for creating a Web Service

I am new to .NET and creating the web services. I am having a complex Oracle query that needs to be executed when the services is called. I am just giving the sample of the query below. SELECT STCD_PRIO_CATEGORY_DESCR.DESCR,…
trx
  • 2,077
  • 9
  • 48
  • 97
0
votes
1 answer

How to exclude all virtual properties from classes inheritted from ClassMapper by default?

I have a lot of POCO classes that contain several virtual properties each. Something like this: public class Policy { public int Id { get; set; } public int EntityId { get; set; } public int ProgramId { get; set; } public string…
Red
  • 818
  • 2
  • 14
  • 26
0
votes
1 answer

Dapper Contrib Insert MySQL Syntax Error

Hey I am getting syntax error in MySQL using Dapper.Contrib MySQL server version for the right syntax to use near '[cause_code],[cause_name]) values ('000-DDH', 'No Money')' at line 1 the correct syntax for Insert in mysql is "Insert Into…
jake talledo
  • 610
  • 11
  • 24
0
votes
1 answer

Multi-Mapper in Dapper one to many relations

I am trying to get the value of my database with a relation one to many i have my object like this Student [Table("Student")] public class Student : IStudent { public int Id { get; set; } public string Lastname { get;…
armory09
  • 114
  • 12
0
votes
1 answer

C# Identity UserManager CreateAsync then FindByEmailAsync returns User with Id=0

Identity with Dapper. My user in my Identity is of type IUser< int > When a user Registers, I create a user in my AccountController: Register POST: if (ModelState.IsValid) { user = new MySiteUserRecord { UserName = model.UserName, …
0
votes
1 answer

Dapper Extensions for Date comparision using Predicate

How do you compare the date values using predicate group this is what I have been trying to do var predicateGroup = new PredicateGroup { Operator = GroupOperator.And, Predicates = new List() }; …
Sid
  • 178
  • 2
  • 16
0
votes
1 answer

With Dapper Extensions, how do I sort by random?

It seems sorting in Dapper Extensions can be achieved with Predicates: Predicates.Sort(p => p.LastName) My question is, how do I implement random sorting (i.e. RAND() in sql) to predicates?
Feng Jiang
  • 1,776
  • 19
  • 25
0
votes
2 answers

Dapper Extensions - Object of type 'System.Int32' cannot be converted to type 'System.Int16'

I am using dapper extensions (SqlMapperExtensions.cs). When doing a simple insert: db.Insert(student); I get an exception: Object of type 'System.Int32' cannot be converted to type 'System.Int16'. The Id type in the db is SmallInt. The Id…
Yaron Levi
  • 12,535
  • 16
  • 69
  • 118
0
votes
1 answer

Dapper.Contrib Generate Update Script With ROWLOCK

I am using Dapper as ORM and generating insert,update script by Dapper.Contrib extensions. I want to generate Update script include Rowlock. Is there any usage except changing generic code below in SqlMapperExtensions. public static bool…
trcn
  • 1
  • 1