dapper

Dapper:安装Dapper时报错

强颜欢笑 提交于 2020-02-22 08:26:48
今天在使用VS 2013安装Dapper的时候报错,具体报错信息如下: 经过网上查找错误原因,发现是安装的Dapper版本过高,.Net Framework版本不支持该版本的Dapper。 解决方案: 安装低版本的Dapper。 如果使用的是vs2013,建议在程序包管理器控制台里面进行安装。如果是vs2017,可以直接在管理Nuget程序包里面进行安装,vs2017安装的时候支持选择特定版本进行安装。 在程序包管理器控制台里面输入下面的命令进行安装: Install-package dapper -Version 1.50.2   结果: 这里安装的是1.50.2版本的dapper,这时就可以安装成功了。 来源: https://www.cnblogs.com/dotnet261010/p/9527774.html

Correct method of deleting over 2100 rows (by ID) with Dapper

前提是你 提交于 2020-02-10 07:57:13
问题 I am trying to use Dapper support my data access for my server app. My server app has another application that drops records into my database at a rate of 400 per minute. My app pulls them out in batches, processes them, and then deletes them from the database. Since data continues to flow into the database while I am processing, I don't have a good way to say delete from myTable where allProcessed = true . However, I do know the PK value of the rows to delete. So I want to do a delete from

Correct method of deleting over 2100 rows (by ID) with Dapper

梦想的初衷 提交于 2020-02-10 07:57:05
问题 I am trying to use Dapper support my data access for my server app. My server app has another application that drops records into my database at a rate of 400 per minute. My app pulls them out in batches, processes them, and then deletes them from the database. Since data continues to flow into the database while I am processing, I don't have a good way to say delete from myTable where allProcessed = true . However, I do know the PK value of the rows to delete. So I want to do a delete from

Return Multiple Out and Return Image value in C# using Dapper

蓝咒 提交于 2020-02-08 10:31:11
问题 How to return image from Stored procedure using Dapper in C#? I have a stored procedure with multiple out's and a return value. I want to read the return type in C# PFB the Code and Stored procedure. Please suggest me how to resolve this. CREATE PROCEDURE procedure_Sessions @id nvarchar(80), @IsLocked bit OUTPUT, @LockAge int OUTPUT AS DECLARE @textptr AS varbinary(16) DECLARE @length AS int DECLARE @now AS datetime SET @now = GETUTCDATE() -- Update Query Begins not complete Query example --

Dapper multi-parameter stored procedure query returns nothing back from database

假装没事ソ 提交于 2020-02-05 03:54:11
问题 I have been using Dapper as my ORM for my .NET Core Web Api. When using Dapper to query a stored procedure from my database with one parameter, it works exactly as expected. When I add more than one parameter, it does not return anything back to my datamodel like it should. I suspect this has to do either with my syntax or the way I am structuring the query. The stored procedure I am using below works as expected when executed inside a SSMS query window. Here is my method containing the

How to split a SQL Select query into two Model C# with Dapper ORM

不羁岁月 提交于 2020-02-04 05:48:28
问题 I want to split data into two separate models with DAPPER ORM in C#, From TeamId to Location between a column in one model and RowNumber to PageCount into another sperate model. 回答1: I believe what you are trying to simulate would be an object such as: public class Team { public int Id { get; set; } public string Name { get; set; } public Supervisor Supervisor { get; set; } public Location Location { get; set; } } You can actually achieve this with Dapper up to seven objects, basically what

How to split a SQL Select query into two Model C# with Dapper ORM

半腔热情 提交于 2020-02-04 05:48:13
问题 I want to split data into two separate models with DAPPER ORM in C#, From TeamId to Location between a column in one model and RowNumber to PageCount into another sperate model. 回答1: I believe what you are trying to simulate would be an object such as: public class Team { public int Id { get; set; } public string Name { get; set; } public Supervisor Supervisor { get; set; } public Location Location { get; set; } } You can actually achieve this with Dapper up to seven objects, basically what

Handle Oracle Database Connection in Dapper

会有一股神秘感。 提交于 2020-01-23 01:49:07
问题 I am trying to connect to the Oracle Database and trying to execute a query. So below is my Model Class using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; namespace TestAPI.Models { public class TestAPIModel { [Key] public int PRIO_CATEGORY_ID { get; set; } public int LANG_ID { get; set; } public System.DateTime REC_DATE { get; set; } public int REC_USER { get;

Check if record exists with Dapper ORM

走远了吗. 提交于 2020-01-22 10:56:47
问题 What is the simplest way to check if record exists using the Dapper ORM? Do I really need to define POCO objects for a query where I only want to check if a record exists? 回答1: int id = ... var exists = conn.ExecuteScalar<bool>("select count(1) from Table where Id=@id", new {id}); should work... 回答2: I think this may have a tad less overhead as there's no function call or data type conversions: int id = ... var exists = connection.Query<object>( "SELECT 1 WHERE EXISTS (SELECT 1 FROM MyTable

Dapper & TransactionScope?

…衆ロ難τιáo~ 提交于 2020-01-20 13:21:46
问题 I just started playing around with Dapper. So far i love it. Does dapper not work with TransactionScope ? I noticed that even if i never call TransactionScope.Complete then my changes are still committed to the database. If TransactionScope isn't supported now is there any plans in the future to support it? If not then you have to use traditional transaction management (System.Transactions.Transaction)? Update: I just talked to Sam over Twitter. It should work. I'll update it tomorrow morning