问题标签 [dapper-extensions]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
5115 浏览

c# - 插入 Guid 并使用 dapper 检索值

我正在尝试将一条记录插入我的数据库并检索它刚刚添加的 GUID。

假设我有一个包含 3 列的表,GUID, FirstName, LastName。我需要插入一条新记录,然后取回刚刚生成的 GUID。问题是名字和姓氏经常重复。我不太确定如何完成

这是我尝试过的,我知道以下内容不起作用,因为我并没有真正告诉它要选择哪一列,而且我不知道如何告诉它:

我得到的错误是

序列不包含任何元素

0 投票
1 回答
3116 浏览

ms-access - Dapper Extension Ms Access System.Data.OleDb.OleDbException

我刚开始使用 Dapper。Dapper 工作正常。作为我尝试与 Dapper Extension 集成的下一步。它会生成一个名为 System.Data.OleDb.OleDbException 的异常"Additional information: Characters found after end of SQL statement.",这是为什么呢?Dapper Extension 不支持 Ms Access(因为结束字符)或我的代码有问题,或者我遗漏了一些东西。我的代码如下

0 投票
1 回答
1864 浏览

dapper - Dapper Extension Get & Update 返回错误

我尝试使用 Dapper Extension 和 MS Access 并在一定程度上取得了成功。我的代码在下面列出。除获取和更新外,所有功能都正常工作(插入/计数/获取列表/删除)。我总结了下面的代码。如果有人愿意,我可以在这里粘贴所有代码

我的产品类别

在我的主要课程中。我尝试获取该产品并按如下方式对其进行更新。con.Get<Products>函数返回带有 “序列包含多个元素”消息con.Update<Products>的异常,并返回带有“必须定义至少一个键列”的异常。

即使con.Get<Products>失败也con.GetList<Products>(predicate)能完美运行。我确实按照此链接进行设置

0 投票
1 回答
3362 浏览

c# - 无法使用 Dapper.NET 将文件流插入 SQL 文件表

我在我的项目中使用 Dapper.NET 作为 ORM 层。我正在尝试为文件上传和下载编写 WebApis。但是我无法让它工作。我已经进行了足够多的搜索以寻求帮助,但我找不到任何帮助。

如果我只是使用 ADO.NET,我可以将 VarBinary 类型的 SqlParameter 用于文件流。但是 Dapper.NET 查询参数只是动态对象。因此,以下代码无法将记录插入文件表。

抛出异常:mscorlib.dll 中的“System.NotSupportedException”

附加信息: System.IO.Stream 类型的成员 fileStream 不能用作参数值

有没有人这样做或知道我可以使用的任何小巧的扩展插件?

0 投票
1 回答
943 浏览

mysql - DapperExtensions 谓词中不区分大小写的比较

我正在尝试在使用 Dapper Extensions 时对 MySQL 表进行不区分大小写的匹配,但是当尝试在 linq 表达式中将其设为大写时,字段名称出现空异常:

这是代码:

有人知道我如何使用 DapperExtensions 谓词进行不区分大小写的匹配吗?

谢谢你的帮助,codenewbie

0 投票
4 回答
2012 浏览

visual-studio - Visual Studio 无法解析 Dapper.Extension 命名空间

我正在尝试学习如何使用 Dapper.Extension 但经过多次尝试安装和重新安装 nuget 包。我无法让命名空间解析和使用。我正在创建一个通用存储库,但是当我尝试包含命名空间时,VS 甚至看不到它。我查看了他们的文档和安装指南,但看不到其他人有这个问题。我在寻找什么愚蠢的东西吗?请参阅下面使用扩展名的 Find 方法。

0 投票
1 回答
1004 浏览

c# - DapperExtensions MySQL 插入集 ID

如果我有一堂课:

我尝试使用 Dapper/DapperExtensions 将其插入到相应的 MySQL 表中:

假设 MySQL 中的 Id 列设置为 AUTO_INCREMENT 并且该表为空。然后在某处将 Id 值 10 更改为 1。

是否可以使用 Dapper/DapperExtensions 插入正确的 ID 10?

0 投票
1 回答
461 浏览

entity-framework - Dapper 扩展 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; }
}


Problem with: Dapper Extensions dbConnection.Get(personId)

I have a model called Person:

In the database I have this table:

When I try this without any kind of custom mapping, I get an error "Invalid object name 'Person'." I believe this is a mapping issue, because when I completely map the model with the prefix 'Pers_', and use 'data.Persons' Get works.

But is there a way to automatically map with a prefix? The database I'm using has many different tables with different prefices.

I also have everything already mapped to Entity framework. Is there a possibility of getting the map settings from Entity DbModelBuilder?


MS Access Project 2007 SP3 slow performance

I have a project built on MS Access project and There is a strange slow performance issue on MS Access 2007 SP3

I track this issue on two machines that are:

  1. Windows 7 - 64 bit
  2. Microsoft Office Access 2007 (12.0.6606.1000) SP3 MSO (12.0.6607.1000)
  3. SQL SERVER 2008 R2
  4. SQL SERVER Driver (oledb.dll) Version 6.01.7601.17514

There is no difference between two PCs that I try to test but there is obvious slow performance when I open the same screen (I watch SQL SERVER Profiler and I noticed that same query takes 4 sec on first environment and takes 1.5 minute on second environment, and also the Reads column on profiler give a big number for the slow query)

The query is:

SELECT MReceiveNumber, [Line Number], [Item Number], ROW_NUMBER() OVER (ORDER BY [Line Number]) - dbo.GetPrevMRQryLinesCount(MReceiveNumber, [Line Number]) AS Serial FROM tblMReceiveItems

Note: This query takes 2.20 minutes in SQL SERVER Management

So, Is there any performance issue with access 2007 SP3 or there are other things that I should do/review?

Thank you for help.

0 投票
1 回答
2509 浏览

dapper-extensions - 使用 Dapper 插入具有默认值的表

我有一个表,该表的字段不为空,并且定义了默认值

我在模型中为 dapper 使用的属性是可为空的 DateTime

如果我尝试插入,尝试在非空字段中插入空值会引发异常。

我正在寻找的是由数据库设置的默认值,并且在我读取对象时仍然能够看到该值。因为 Dapper 将值作为 null 传递,所以数据库会抛出错误。如果我忽略该属性,那么我将失去阅读它的能力。我希望有一个单向的忽略,或者一个让 dapper 知道会有默认值的标志。如何使这项工作?

0 投票
1 回答
2446 浏览

sorting - 如何在 Dapper 扩展中使用 DESC 顺序根据 Order by 子句对数据进行排序?

我想按 DESC 顺序对数据进行排序。这是我的代码:

使用 Dapper Extensions,我无法对数据进行排序。上面的代码抛出以下错误:

未找到 PropertyName...

我正在myPoco使用 Dapper Extension 的ClassMapper.