更新框架

This commit is contained in:
chfei committed 2026-10-27 14:35:03 +08:00
1 parent ef50fa0620
commit 84b28f9672
72 files changed
+2222 -282

No files matched your search

+8 -21
View File
@@ -1,4 +1,4 @@
/***
/***
* _ooOoo_
* o8888888o
* 88" . "88
@@ -20,7 +20,7 @@
*
* .............................................
* 佛祖保佑 永无BUG
* 快加工资 不改需求
* 快加工资 不改需求
*/
@@ -28,12 +28,8 @@ using Autofac;
using MAX.Core.DependencyInjection;
using MAX.Core.Infrastructure;
using MAX.Core.Reflections;
using MediatR;
using System;
using System.Collections.Generic;
using MAX.Notification;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
namespace MAX.Core;
@@ -50,10 +46,13 @@ public class Startup : IStartup
{
builder.RegisterInstance(LazyServiceProvider.Instance).As<ILazyServiceProvider>().AsSelf().SingleInstance();
#region 注册MediatR
#region 注册通知服务
Assembly[] assemblies = AppTypeFinder.Assemblies.ToArray();
builder.RegisterType<MediatorManager>().As<IMediator>().AsSelf().SingleInstance();
builder.Register(ctx => new MediatorManager(
new AutofacNotificationServiceProvider(ctx.Resolve<ILifetimeScope>())))
.As<IPublisher>().AsSelf().InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(assemblies)
.AsClosedTypesOf(typeof(INotificationHandler<>))
@@ -61,18 +60,6 @@ public class Startup : IStartup
.AsSelf()
.InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(assemblies)
.AsClosedTypesOf(typeof(IRequestHandler<>))
.AsImplementedInterfaces()
.AsSelf()
.InstancePerLifetimeScope();
builder.Register<ServiceFactory>(ctx =>
{
var c = ctx.Resolve<IComponentContext>();
return t => c.Resolve(t);
}).SingleInstance();
#endregion
}
}