From b7efe0cac4ddf6d88fd1b6e1a044a2ce116b5035 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 14 Feb 2026 11:17:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E9=9B=86=E6=88=90=20Mediator=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E5=B9=B6=E9=85=8D=E7=BD=AE=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 Mediator 框架依赖注入配置 - 设置 Mediator 命名空间为 GFramework.Core.Mediator - 配置 Mediator 服务生命周期为单例模式 - 设置生成类型为内部访问权限 - 配置通知发布器类型为 ForeachAwaitPublisher - 添加必要的 using 语句引入 Mediator 和常量模块 --- GFramework.Core/architecture/Architecture.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GFramework.Core/architecture/Architecture.cs b/GFramework.Core/architecture/Architecture.cs index 5b418f9..e7a00e3 100644 --- a/GFramework.Core/architecture/Architecture.cs +++ b/GFramework.Core/architecture/Architecture.cs @@ -10,6 +10,7 @@ using GFramework.Core.Abstractions.utility; using GFramework.Core.environment; using GFramework.Core.extensions; using GFramework.Core.logging; +using Mediator; using Microsoft.Extensions.DependencyInjection; using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable; @@ -625,9 +626,14 @@ public abstract class Architecture( // 为服务设置上下文 Services.SetContext(_context); - // 添加 Mediator - Container.Services.AddMediator(); + Container.Services.AddMediator(options => + { + options.Namespace = "GFramework.Core.Mediator"; + options.ServiceLifetime = ServiceLifetime.Singleton; + options.GenerateTypesAsInternal = true; + options.NotificationPublisherType = typeof(ForeachAwaitPublisher); + }); // === 用户 Init === _logger.Debug("Calling user Init()");