From fc0781a313b3b7051d81c888a46563107ba4ea4b Mon Sep 17 00:00:00 2001 From: xuejiaming <326308290@qq.com> Date: Tue, 14 Feb 2023 18:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dabp=E7=9A=84bug=E7=9A=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/Samples.AbpSharding/AbstractShardingAbpDbContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Samples.AbpSharding/AbstractShardingAbpDbContext.cs b/samples/Samples.AbpSharding/AbstractShardingAbpDbContext.cs index 55f6c544..2b7db47b 100644 --- a/samples/Samples.AbpSharding/AbstractShardingAbpDbContext.cs +++ b/samples/Samples.AbpSharding/AbstractShardingAbpDbContext.cs @@ -50,7 +50,7 @@ namespace Samples.AbpSharding if (dbContext is AbpDbContext abpDbContext && abpDbContext.LazyServiceProvider == null) { abpDbContext.LazyServiceProvider = this.LazyServiceProvider; - if (dbContext is IAbpEfCoreDbContext abpEfCoreDbContext) + if (dbContext is IAbpEfCoreDbContext abpEfCoreDbContext&&this.UnitOfWorkManager.Current!=null) { abpEfCoreDbContext.Initialize( new AbpEfCoreDbContextInitializationContext(