diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs index 7c3c568a..d8320613 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs @@ -25,7 +25,7 @@ public class FlashSalePlanCacheInvalidator : ILocalEventHandler + UnitOfWorkManager.Current?.OnCompleted(async () => { await DistributedCache.RemoveAsync(eventData.Entity.Id); }); diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/ProductCacheInvalidator.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/ProductCacheInvalidator.cs index d9d1ed46..4e975b85 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/ProductCacheInvalidator.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/ProductCacheInvalidator.cs @@ -28,7 +28,7 @@ public class ProductCacheInvalidator : { await DistributedCache.RemoveAsync(eventData.Entity.Id); - UnitOfWorkManager.Current.OnCompleted(async () => + UnitOfWorkManager.Current?.OnCompleted(async () => { await DistributedCache.RemoveAsync(eventData.Entity.Id); }); @@ -38,7 +38,7 @@ public class ProductCacheInvalidator : { await DistributedCache.RemoveAsync(eventData.Entity.Id); - UnitOfWorkManager.Current.OnCompleted(async () => + UnitOfWorkManager.Current?.OnCompleted(async () => { await DistributedCache.RemoveAsync(eventData.Entity.Id); });