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. JDK-8不是有效的Win32应用程序

  2. 360随身wifi隐藏ssid方法

    360随身wifi隐藏ssid方法 以win7为例,介绍如何隐藏360随身wifi ssid方法 一.    禁止360随身wifi官方驱动自启动方法: 1. 找到360wifi自启动文件: 进入以下 ...

  3. python之socket运用之传输大文件

    socket建议最大的传输单元是8192个字符,但是如果超过8192就会出现问题,我们可以用下面的方法处理 客户端代码 import subprocess import socket ip_bind ...

  4. [leetcode]211. Add and Search Word - Data structure design添加查找单词 - 数据结构设计

    Design a data structure that supports the following two operations: void addWord(word) bool search(w ...

  5. Python学习day5作业

    目录 Python学习day5作业 ATM和购物商城 1. 程序说明 2. 基本流程图 3. 程序测试帐号 4. 程序结构: 5. 程序测试 title: Python学习day5作业 tags: p ...

  6. php不重新编译,安装未安装过的扩展,如curl扩展

    假设我们的之前的php安装于/data/php下. 1.找到之前安装的PHP源码包,把它重新解压出来,进入到要安装的扩展目录. > cd /data/php-5.6.11/ext/curl (* ...

  7. Win10 激活

    先看看你的WIN10激活状态:1.右键开始菜单2.运行3.slmgr.vbs -xpr KMS卸载方法:1.如果是KMSPico,则自带服务卸载批处理,2.不管是哪种KMS工具,卸载掉软件之后请执行以 ...

  8. iOS.ObjC.Compiler.Directives

    Objective-C Compiler Directives @dynamic "You use the @dynamic keyword to tell the compiler tha ...

  9. 并发编程(四)TaskFuture

    并发编程(四)TaskFuture ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<O ...

  10. 11 Maven 灵活的构建

    Maven 灵活的构建 一个优秀的构建系统必须足够灵活,它应该能够让项目在不同的环境下都能成功地构建.例如,典型的项目都会有开发环境.测试环境和产品环境,这些环境的数据库配置不尽相同,那么项目构建的时 ...