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);
    ....
}

 

相关文章:

  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2021-06-13
  • 2022-03-02
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
相关资源
相似解决方案