From f84356592a956dd5a761a56640f71d06c60b1617 Mon Sep 17 00:00:00 2001 From: Manoel Ferreira Neto Date: Tue, 25 May 2021 22:34:29 -0300 Subject: [PATCH] Implementing IInfrastructure interface in order to the GetDbTransaction extension method of EF core work (#891) --- .../IDbContextTransaction.CAP.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/DotNetCore.CAP.PostgreSql/IDbContextTransaction.CAP.cs b/src/DotNetCore.CAP.PostgreSql/IDbContextTransaction.CAP.cs index 8bd7619..794ea2e 100644 --- a/src/DotNetCore.CAP.PostgreSql/IDbContextTransaction.CAP.cs +++ b/src/DotNetCore.CAP.PostgreSql/IDbContextTransaction.CAP.cs @@ -2,14 +2,16 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; +using System.Data.Common; using System.Threading; using System.Threading.Tasks; using DotNetCore.CAP; +using Microsoft.EntityFrameworkCore.Infrastructure; // ReSharper disable once CheckNamespace namespace Microsoft.EntityFrameworkCore.Storage { - internal class CapEFDbTransaction : IDbContextTransaction + internal class CapEFDbTransaction : IDbContextTransaction, IInfrastructure { private readonly ICapTransaction _transaction; @@ -51,5 +53,14 @@ namespace Microsoft.EntityFrameworkCore.Storage { return new ValueTask(Task.Run(() => _transaction.Dispose())); } + + public DbTransaction Instance + { + get + { + var dbContextTransaction = (IDbContextTransaction) _transaction.DbTransaction; + return dbContextTransaction.GetDbTransaction(); + } + } } } \ No newline at end of file