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. subprocess 粘包问题

    1.执行命令: 在py代码中去如何调用操作系统的命令 新模块:subprocess r = subprocess.Popen('ls',shell=True,stdout=subprocess.PIP ...

  3. forward(请求转发)和redirect(重定向)的区别

    原理: forward是服务器请求资源,服务器直接访问目标地址的URL,把那个URL的响应内容读取过来,然后把这些内容再发给浏览器,浏览器根本不知道服务器发送的内容是从哪儿来的,所以它的地址栏中还是原 ...

  4. php页面的基本语法

    概述: 1. PHP 脚本在服务器上执行,然后将纯 HTML 结果发送回浏览器. 2. PHP 脚本以 <?php 开始,以 ?> 结束,可以放到文档中的任何位置. 3. 当 PHP 解析 ...

  5. C#中如何创建xml文件 增、删、改、查 xml节点信息

    XML:Extensible Markup Language(可扩展标记语言)的缩写,是用来定义其它语言的一种元语言,其前身是SGML(Standard Generalized Markup Lang ...

  6. iOS 管理库 Carthage 安装以及使用

    https://blog.csdn.net/Mazy_ma/article/details/70185547

  7. Nginx配置杂记(转)

    转至:http://www.cnblogs.com/kuangke/p/5619400.html Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器,相较 ...

  8. 分析maven的优点

    1.依赖管理: 就是对jar包的管理. 2.项目的一键构建: 编译--->测试--->运行--->打包--->安装 运行一个maven工程(web工程)只需要一个命令:toma ...

  9. ServiceStack支持跨域提交

    //ServiceStack对浏览器有一定的限制 //修改AppHost.cs文件 using Funq;using ServiceStack;using ServiceStackTest.Servi ...

  10. laravel-excel文档翻译笔记

    1.安装      1>composer 安装 "maatwebsite/excel": "~2.1.0"      2>app/config/ap ...