Questions tagged [dapper]

dapper is the micro-ORM for .NET developed and used by the stackoverflow team, focusing on raw performance as the primary aim.

Filter by
Sorted by
Tagged with
13
votes
5answers
13k views

Is this Repository Design Pattern Valid and efficient?

I am using Dapper ORM in my Data access Layer, but I think analysis of the code below doesn't depend upon any specific ORM. What should be the single common place throughout the entire Data Access ...
12
votes
2answers
8k views

Mapper made specifically to work with Dapper

I needed a mapper for a project I have using Dapper. I tried Automapper and other tools that comes with Dapper (Contrib, Rainbow, etc.), but I couldn't make Automapper work properly and the rest doesn'...
9
votes
2answers
2k views

Compare Oracle Table with SQL Server Table and Update/Insert

Below is the current code which is used to update/insert records from Oracle view to SQL Server table using Dapper. There is not a field to check last record updated date in the oracle view so I have ...
6
votes
1answer
4k views

Dapper helper service

I've written a very light wrapper around Dapper to help with unit testing and streamlining the Dapper commands I need. Execute() is a method created to remove the ...
5
votes
2answers
18k views

List<dynamic> to ComboBox

This code get a list<dynamic> from a repository class using Dapper. I need to bind this list to a ...
4
votes
2answers
762 views

Repository pattern with Unit of work using ADO.NET in C# to authenticate user from database

So I am using the latest version of Dapper and it works great for mapping my POCO classes but there are some scenarios where I need to return a DataSet instead of ...
4
votes
1answer
3k views

Dapper "async" and "await using"

I have been building my data access layer and performance is key for the project I am working on. I have chosen to use Dapper and dotnet core 3. I want to make use of the latest and greatest async ...
4
votes
2answers
8k views

Multiple connection string in Web API 2

I have a Web API 2 using Dapper.net, and it's accessed by various client with their own database. Currently, I'm using custom header called Client-Id to identify ...
4
votes
1answer
2k views

Updating complex objects

I'm mainly looking at usage of Dapper, but in general, any comments relating SQL -> C# object mapping best practices would be appreciated. I've got two super simple objects I'm working with: ...
4
votes
1answer
673 views

Micro ORM on the lines of dapper

Designing a micro ORM inspired by Dapper. I'm building this as an exercise to learn. I would appreciate if you guys can review my code. I would also appreciate any suggestions regarding the features ...
4
votes
1answer
180 views

Is my structure of program readable?

Just looking for reviews to improve my coding and my structure of C#. It feels I probably have some unnecessary code that is not needed, been following some YouTube videos to accomplish some tasks. ...
3
votes
1answer
240 views

CRUD integration test, is it ok?

I want to test my CRUD operation to a MySql database (I use dapper as my ORM). This is what I wrote with ...
3
votes
2answers
1k views

Multiple methods to connect to MySQL and execute a query

The Code ...
3
votes
1answer
4k views

Using dapper.net and repository pattern in Azure websites

I'm currently on Azure Websites & Azure SQL, some documentation recommends using Async as much as possible as cloud services higher latency and have chances of dropping traffic, but it's also ...
3
votes
0answers
3k views

Structure and Implementation of Generic Repository and Unit of Work patterns with Dapper and SqlTransactions

I am attempting to update some legacy code that I work with, but my knowledge of data access is limited to a basic use of Entity Framework and simple Dapper. After some research, I have a loose ...
3
votes
0answers
508 views

Deriving classes to decorate auto-generated base class code with attributes

Background: I am currently in the process of abstracting and refactoring out EF for Dapper with ...
2
votes
1answer
2k views

Navigation properties with sql/dapper

I want to have the same experiance with slq/dapper for my navigation properties just like in Entity Framework. But I'm not sure which sql query i should use. As you see, every single Resource entity ...
2
votes
2answers
7k views

Repository Pattern with Dapper + Unity

I just finished the Pluralsight courses about Inversion of Control and Mirco-ORMs, and I am struggling with the implementation aspect of some of the concepts. This is my (simplified) repository ...
2
votes
2answers
78 views

Dapper with shops and payers

I live in the buildings that have 50 people in it and for each floor splits into 2 groups each group is from ~9 people. I'm trying to build an Xamarin app (IOS, ANDROID ,Win10,maybe web app) to make ...
2
votes
1answer
67 views

Reducing Inventory Quantity When Order Is Being Processed

I've got a method which removes quantity from inventory when an order is completed. If there is not enough inventory quantity available, the order completion fails and the sql transaction is rolled ...
2
votes
1answer
2k views

Custom C# Dapper ORM wrapper

I am I C#.NET developer for a few years now... Last couple of months I have started to study design patterns and enterprise software architecture principles so that I will be able to use those ...
2
votes
1answer
3k views

Integration tests for a repository with the help of AutoFixture

I find it hard to do integration tests for a repository and very time consuming. Things I think about when creating integration tests for a repository: Should I skip them? Should I create an in ...
2
votes
1answer
2k views

Querying a database with Dapper

In the current project that I am working on, we are using dapper to query the database and sometime when mapping from dynamic types to concrete types we end up with a messy block of code. I created a ...
2
votes
0answers
184 views

A custom session with transaction support using Dapper

I wanted to write a custom session to act as proxy for a Dapper connection that could support transactions without having to expose any other DB related entities. At first, I thought of opening a ...
1
vote
1answer
11k views

Using dapper Unit of Work in 3-tier architecture

The Unit of Work: ...
1
vote
3answers
102 views

Is this method for loading data in a C# application recommended?

Goal I'd like to understand if this current method, of loading data and inserting data into a database I currently use is to be avoided? Code I drafted a simple application that loads data and inserts ...
1
vote
1answer
80 views

Getting names/values of multiple properties [closed]

Lets say I have one method, which extracts property name and value: ...
1
vote
2answers
862 views

Manage connection string

I'm using dapper-dot-net for data access in my ASP.NET MVC application. So in order to supply a connection string I've came up ...
1
vote
0answers
497 views

Simple AuditLog

I am using ADO.NET in my project and I want to have a simple AuditLog. I have below Codes for that but I wounder to know is ...
1
vote
0answers
95 views

Add or modify bunch of data into database

I got my code works fine, but I am not really sure whether the approach that I took is a best practice or not. So, I decided to ask in this forum instead. So here is my situation: I got my model ...
1
vote
0answers
955 views

Interface for Dapper repository

I'm creating a little proposal for the data access layer using Dapper ORM. The code is based in an generic interface IStore: ...
1
vote
0answers
872 views

Repository pattern with data access objects

I started a new ASP.NET project in an effort to better learn SQL and Dapper ORM framework. My idea for data access: Have POCO entities, for each entity have DAO object. When I want to manipulate with ...
0
votes
1answer
118 views

Is this correct way to setup DB Infrastructure with repository pattern and Dapper

So, I am using Repository pattern with Dapper and ADO.NET. I have my based DB infrastructure setup as follows: ...
0
votes
1answer
1k views

Asynchronously fetching data from the database

The following C# code is written to fetch the Categories data from SQL Server Database using Asynchronous Task for HttpGet. The Dapper library is used as ORM. I ...
0
votes
1answer
779 views

Is there a better approach to implementing Dapper with Mediatr?

I'm playing around with using Dapper with Mediatr in a .NET Core API. It's all working nicely. Its a learning project for me so I am just putting together a system that will hold user details ...
0
votes
0answers
208 views

Dapper UOW with Multiple Databases

Scenarios / Requirements: I am working on to convert the existing WebAPI Data Layer to Dapper from EF. The following are the ...