zzz projects Dapper Tutorial
Getting Started Documentation 3rd Party Libraries Knowledge Base Online Examples
  • Getting Started
  • Documentation
  • 3rd Party Libraries
  • Knowledge Base
  • Online Examples
  •   Download  

Dapper Tutorial - Knowledge Base (KB)

74 results in tag: c#

How can I use Dapper to insert and retrieve the identity value?

How do I perform an insert to database and return inserted identity with Dapper?...I've tried something like this:...string sql = "DECLARE @ID int; " + "INSERT INTO [MyTable] ([Stuff]) VALUES (@Stuff); " + "SELECT @ID = SCOPE_IDE...
c# dapper sql-server
asked by ppiotrowicz

How to set the CommandTimeout value in Dapper?

I'm trying to run SQL backups through a stored procedure through Dapper (the rest of my app uses Dapper so I'd prefer to keep this portion running through it as well). It works just fine until the CommandTimeout kicks in....using (var c = SqlConnection(co...
.net c# dapper timeout
asked by sh-beta

How can I use Dapper and manage the database connections?

I've been playing with Dapper, but I'm not sure of the best way to handle the database connection. ...Most examples show the connection object being created in the example class, or even in each method. But it feels wrong to me to reference a connection...
.net c# dapper
asked by Donald Hughes

How to use Dapper to put a C# List into a database

Using ...dapper..., how can I insert a ...C# List... to database. Previously without ...dapper... I used the below code to ...insert the List values to database.......try { connection.Open(); for (int i = 0; i < processList.Count...
c# dapper sql-server
asked by Praveen

How to return a DataTable with Dapper?

I have a scenario where I need to return a ...DataTable... from a query using Dapper. How do I return a ...DataTable... from a query using Dapper?...DataTable dt = connection.Query("SELECT * FROM table");
c# dapper
asked by user2421145

How to use CancellationToken with Dapper async methods?

I'm using Dapper 1.31 from Nuget. I have this very simple code snippet,...string connString = ""; string query = ""; int val = 0; CancellationTokenSource tokenSource = new CancellationTokenSource(); using (IDbConnection conn = new SqlConnection(connString...
.net async-await c# cancellation-token dapper
asked by Pedigree

What best practices to use for connection and query in Dapper?

So i've read a bunch of links/SO questions, but i still can't get a clear answer on this....When performing SQL queries with Dapper in an ASP.NET application, what is the best practice for opening/closing connections?...Here's the pattern i'm currently fo...
.net asp.net c# dapper sql-server
asked by RPM1984

In Dapper, how can I update several entries in one sql statement?

I am attempting to use one single Update statement to update multiple records with different values (I'm not trying to update many rows to have the same values which is pretty straight forward). Here's what I'm trying right now:... using (var cn = Get...
c# dapper sql-server
asked by Kento

How to pass Table Valued Parameters with Dapper Dynamic Parameters?

I was trying to create a generic method, which can read the parameters name and value from a class at Runtime and create parameter collection for Dapper query execution. Realized that till the point all parameters are Input type it works well, but if I ha...
c# dapper datatable sql-server stored-procedures
asked by Mrinal Kamboj

How to use QueryMultiple method to allows you to get a result and a count at the same time in Dapper?

I wrote two segments of SQL command and want to process in one query like this:...SELECT COUNT(*) FROM books SELECT * FROM books ORDER BY bookID OFFSET 1000 ROWS FETCH NEXT 10 ROWS ONLY ...How can I use ...conn.QueryMultiple... method to get ...count... ...
.net c# dapper sql sql-server
asked by ineztia

Why dapper return ToList() cannot be used in an async method?

I'm trying to change a method to make it async and using Dapper This is the current method in a repository class:...... public class ClientsRepository : BaseRepository { public ClientsRepository(string connectionString): base (connectionString...
asynchronous c# dapper
asked by Mr_LinDowsMac

In Dapper, how can I send more than 2100 parameters with an IN clause?

I have a List containing ids that I want to insert into a temp table using Dapper in order to avoid the SQL limit on parameters in the 'IN' clause....So currently my code looks like this:...public IList<int> LoadAnimalTypeIdsFromAnimalIds(IList<int> anima...
c# dapper sql-server
asked by Chris B

What can I do to make my Dapper return a list?

Why I can't add a ....ToList()... on this? The only thing Intellisense is allowing is ....ToString().......//.. string sqlQuery = "SELECT sum(SellingPrice) as SellingPrice, sum(MarkupPercent) as MarkupPercent, sum(MarkupAmount) as MarkupAmount FROM Profit...
c# dapper
asked by DinaDee

When the PK column is not an identity column, how do I insert data with Dapper?

I'm trying to insert data using Dapper.Contrib, in a table where the primary key column is not an identity column....The database table is created with this script:...begin transaction create table dbo.Foos ( Id int not null, Name...
c# dapper dapper-contrib sql-server
asked by user247702

Is Dapper the quickest method to convert a SqlDataReader result to an object?

I'm comparing materialize time between Dapper and ADO.NET and Dapper. ...Ultimately, Dapper tend to faster than ADO.NET, though the first time a given fetch query was executed is slower than ADO.NET.... a few result show that Dapper a little bit faster t...
ado.net c# dapper sql-server
asked by witoong623

How in Dapper can I map one column to a jSON?

I have a table where I store a dictionary as json in one column. When saving / loading the content to/from the database I'd like to be able to make the json de/serialisation invisible if possible. Is it possible to do this using dapper in some way without...
c# dapper
asked by user3791372

How to use Dapper to insert a list?

I'd like to insert a list of objects in an SQL table....I know this question ...here... but I don't understand....Here is my class :...public class MyObject { public int? ID { get; set; } public string ObjectType { get; set; } public string C...
c# dapper list sql
asked by Vincent Ducroquet

How can I log the auto generated query created 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 queries...
c# dapper dapper-extensions
asked by Amit Joshi

How to read column names from a dynamic variable index with Dapper?

I have an sproc which returns variable number of columns with different column names based on input parameter given to it. (and also number of rows >= 1)...For example, if input is 3, sproc returns 3 columns, and if input is 5, it returns 5. (Not sure on ...
.net c# dapper dynamic
asked by G_S

Why Dapper Contrib only support an entity with a single key?

I'm using ...Dapper... and ...Dapper.Contrib... in an MVC5 c# environment and sometimes (!) when I deploy the production site I get errors stating:...GetAll<T>... only supports an entity with ...a single [Key] or [ExplicitKey]... property at Dapper...
c# dapper dapper-contrib
asked by Mackan

Page 1 of 4
  • 1
  • 2
  • 3
  • 4
  • ยป

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!