From 3be34156cf2e14ad367b1aa1f2cdae07b0b230ea Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 17 Apr 2026 19:17:46 +0800 Subject: [PATCH] =?UTF-8?q?docs(cache):=20=E6=9B=B4=E6=96=B0=20WeakKeyCach?= =?UTF-8?q?e=20=E5=BC=82=E5=B8=B8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为 GetOrAdd 方法添加 valueFactory 返回 null 时的异常说明 - 在 GlobalUsings 中添加 System.Runtime.CompilerServices 引用 --- GFramework.Cqrs/GlobalUsings.cs | 1 + GFramework.Cqrs/Internal/WeakKeyCache.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/GFramework.Cqrs/GlobalUsings.cs b/GFramework.Cqrs/GlobalUsings.cs index 3085d1e1..1e6e7889 100644 --- a/GFramework.Cqrs/GlobalUsings.cs +++ b/GFramework.Cqrs/GlobalUsings.cs @@ -7,3 +7,4 @@ global using System.Reflection; global using Microsoft.Extensions.DependencyInjection; global using System.Diagnostics; global using System.Collections.Concurrent; +global using System.Runtime.CompilerServices; diff --git a/GFramework.Cqrs/Internal/WeakKeyCache.cs b/GFramework.Cqrs/Internal/WeakKeyCache.cs index 7377c2ca..dadf2db4 100644 --- a/GFramework.Cqrs/Internal/WeakKeyCache.cs +++ b/GFramework.Cqrs/Internal/WeakKeyCache.cs @@ -27,6 +27,7 @@ internal sealed class WeakKeyCache /// 已存在或新创建的缓存值。 /// /// 。 + /// 或 返回 。 /// public TValue GetOrAdd(TKey key, Func valueFactory) { @@ -60,6 +61,7 @@ internal sealed class WeakKeyCache /// 已存在或新创建的缓存值。 /// /// 。 + /// 或 返回 。 /// public TValue GetOrAdd(TKey key, TState state, Func valueFactory) {