瀏覽代碼

Implementing IInfrastructure interface in order to the GetDbTransaction extension method of EF core work (#891)

master
Manoel Ferreira Neto 3 年之前
committed by GitHub
父節點
當前提交
f84356592a
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. +12
    -1
      src/DotNetCore.CAP.PostgreSql/IDbContextTransaction.CAP.cs

+ 12
- 1
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<DbTransaction>
{
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();
}
}
}
}

Loading…
取消
儲存