The fix is fairly simple: if you want a Dapper query to participate in a connection, explicitly denote that intent:

private async Task<EResult> ProcessDepotAfterDownload(ManifestJob request, DepotManifest depotManifest)
{
using (var db = await Database.GetConnectionAsync())
using (var transaction = await db.BeginTransactionAsync())
{
// add `transaction` to method call below
var result = await ProcessDepotAfterDownload(db, transaction, request, depotManifest);
await transaction.CommitAsync();
return result;
}
} private async Task<EResult> ProcessDepotAfterDownload(IDbConnection db, IDbTransaction transaction, ManifestJob request, DepotManifest depotManifest)
{
// pass `transaction` to Dapper's QueryAsync below
var filesOld = (await db.QueryAsync<DepotFile>("SELECT `ID`, `File`, `Hash`, `Size`, `Flags` FROM `DepotsFiles` WHERE `DepotID` = @DepotID", new { request.DepotID }, transaction: transaction)).ToDictionary(x => x.File, x => x);
....
}

The transaction associated with this command is not the connection's active transaction的更多相关文章

  1. spring中使用Hibernate中的getCurrentSession报出:createQuery is not valid without active transaction

    1.错误信息 HTTP Status 500 - createQuery is not valid without active transaction type Exception report m ...

  2. spring整合hibernate的时候报异常org.hibernate.HibernateException: createQuery is not valid without active transaction

    在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is n ...

  3. ThinkPHP v3.2.3 数据库读写分离,开启事务时报错:There is no active transaction

    如题:ThinkPHP v3.2.3 数据库读写分离,开启事务时报错: ERR: There is no active transaction 刚开始以为是数据表引擎不对造成的,因为 有几张表的引擎是 ...

  4. 编程异常——假设你报createSQLQuery is not valid without active transaction,...

    非常多时候我们使用hibernate的session时,都是让session在某一执行环境中保持其唯一. 比如在同一线程内用同一个session.在同一方法内用同一session,这样我们就能够用se ...

  5. Exception in thread "main" org.hibernate.HibernateException: save is not valid without active transaction

    在spring4+hibernate4整合过程中,使用@Transactional注解事务会报"Exception in thread "main" org.hibern ...

  6. org.hibernate.HibernateException: getFlushMode is not valid without active transaction

    Spring & Hibernate 整合异常记录: org.hibernate.HibernateException: getFlushMode is not valid without a ...

  7. save is not valid without active transaction

    org.hibernate.HibernateException: save is not valid without active transaction at org.hibernate.cont ...

  8. 如果你报createSQLQuery is not valid without active transaction,请看这里

    原文:https://blog.csdn.net/yinjian520/article/details/8666695 很多时候我们使用hibernate的session时,都是让session在某一 ...

  9. [FATAL_ERROR] Uncaught PDOException: There is already an active transaction

    [FATAL_ERROR] Uncaught PDOException: There is already an active transaction ... $mysql->beginTran ...

随机推荐

  1. hdoj1160 DP--LIS

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 思路: 又是一道LIS的应用题,先预处理,按照w从小到大排列,那么原问题就转变成求该排列的LIS ...

  2. C函数指针的用法

    1.最简单的用法: #include <cstdio> int (*p)(int);//定义一个函数指针变量p(下面的f其实是一个常量函数指针) int f(int x) { printf ...

  3. np.random.randn()、np.random.rand()、np.random.randint()

    (1)np.random.randn()函数 语法: np.random.randn(d0,d1,d2……dn) 1)当函数括号内没有参数时,则返回一个浮点数: 2)当函数括号内有一个参数时,则返回秩 ...

  4. 关于jni调用报UnsatisfiedLinkError的可能

    一.说明 最近在做一个项目,需要使用java去调本地动态连接库,之前做测试的时候直接用pojo进行测试,是能够正常调用的.后面项目需要将接口封装为REST api,所以在spring boot上面开发 ...

  5. Repeater嵌套Repeater

    <asp:Repeater ID="rptXiaoLei" runat="server" OnItemDataBound="rptXiaoLei ...

  6. mysql水平分区

    解决问题:单表数据量过大 ALTER TABLE boc_url_log PARTITION BY RANGE (ulid) ( PARTITION log_1 VALUES LESS THAN () ...

  7. 03 Maven 坐标与依赖

    Maven 坐标与依赖 Maven 的一大功能是管理项目依赖.为了能自动化地解析任何一个 Java 构件, Maven 就必须将它们唯一标识,这就依赖管理的底层基础 一一 坐标.本章将详细分析 Mav ...

  8. linux 基本工具相关

    首先是linux下安装ssh服务(root) 由于是使用debian版本 与其他稍有差别 安装服务 apt-get install ssh 查看服务是否开启 service ssh status 开启 ...

  9. 什么是adb命令?以及如果高效使用他们?

    接下来 我会为大家讲解 最通俗易懂的adb命令 希望大家能够喜欢...

  10. springmvc 整合数据验证框架 jsr

    1.maven <dependency> <groupId>javax.validation</groupId> <artifactId>validat ...