From 08c6521a59c34a64355ee78ae5a5ac7d0fdd7843 Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 14 Mar 2026 11:16:32 +0800 Subject: [PATCH] Use generic EntityNotFoundException in GetManyAsync for consistency with GetAsync --- .../Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs | 2 +- .../Volo/Abp/TestApp/Testing/EntityCache_Tests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs index f2525416d4..6fff3cf67c 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs @@ -90,7 +90,7 @@ public abstract class EntityCacheBase : var cacheItem = cacheItemDict.TryGetValue(id!, out var wrapper) ? wrapper?.Value : null; if (cacheItem == null) { - throw new EntityNotFoundException(typeof(TEntity), id); + throw new EntityNotFoundException(id); } return cacheItem; diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityCache_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityCache_Tests.cs index 09913caaf2..d4f278d468 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityCache_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityCache_Tests.cs @@ -66,8 +66,8 @@ public abstract class EntityCache_Tests : TestAppTestBase(() => ProductEntityCache.GetManyAsync(new[] { notExistId })); - await Assert.ThrowsAsync(() => ProductCacheItem.GetManyAsync(new[] { notExistId })); + await Assert.ThrowsAsync>(() => ProductEntityCache.GetManyAsync(new[] { notExistId })); + await Assert.ThrowsAsync>(() => ProductCacheItem.GetManyAsync(new[] { notExistId })); } [Fact]