本文介绍了Dapper挂在执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有
- IDbConnection
- sql = @UPDATE tablename SET json =:json,lastupdate = SYSDATE WHERE id =:id

I have an- IDbConnection- sql = @"UPDATE tablename SET json = :json, lastupdate = SYSDATE WHERE id = :id"

var param = new DynamicParameters();
param.Add(":json", json, DbType.AnsiString);
param.Add(":id", currentTemplate.Id);

if (connection == null || connection.State != ConnectionState.Open) continue;
connection.Execute(sql, param);  // hangs here.
connection.Query(sql, param);  // tried this and this also hangs.

编码在connection.Execute停止。没有错误或任何东西。只是挂起。

:json是由JsonConvert返回的序列化对象。

:json is a serialized object returned by JsonConvert.

:id is一个字符串

:id is a string

我也尝试删除参数并在SQL本身中包含值。

I've also tried removing the parameters and including the values in the SQL itself.

推荐答案

在我的例子中,我在另一个会话中有一个未提交的事务,如下所示:

In my case, I had an uncommitted transaction in another session, as described here: Oracle Update Hangs

这篇关于Dapper挂在执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 17:15