From 89551d77dd17be01a95e268ba2af39736f1eab20 Mon Sep 17 00:00:00 2001 From: xuejiaming <326308290@qq.com> Date: Mon, 24 Oct 2022 22:25:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RelationTransactions/ShardingRelationalTransaction.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ShardingCore/EFCores/RelationTransactions/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/RelationTransactions/ShardingRelationalTransaction.cs index 80042f8f..0cfc15c7 100644 --- a/src/ShardingCore/EFCores/RelationTransactions/ShardingRelationalTransaction.cs +++ b/src/ShardingCore/EFCores/RelationTransactions/ShardingRelationalTransaction.cs @@ -32,6 +32,10 @@ namespace ShardingCore.EFCores { _shardingDbContext = shardingDbContext ?? throw new ShardingCoreInvalidOperationException($"should implement {nameof(IShardingDbContext)}"); + _shardingDbContextExecutor = shardingDbContext.GetShardingExecutor() ?? + throw new ShardingCoreInvalidOperationException( + $"{shardingDbContext.GetType()} cant get {nameof(IShardingDbContextExecutor)} from {nameof(shardingDbContext.GetShardingExecutor)}"); + } #endif @@ -55,6 +59,10 @@ namespace ShardingCore.EFCores { _shardingDbContext = shardingDbContext??throw new ShardingCoreInvalidOperationException($"should implement {nameof(IShardingDbContext)}"); + _shardingDbContextExecutor = shardingDbContext.GetShardingExecutor() ?? + throw new ShardingCoreInvalidOperationException( + $"{shardingDbContext.GetType()} cant get {nameof(IShardingDbContextExecutor)} from {nameof(shardingDbContext.GetShardingExecutor)}"); + } #endif