添加项目文件。
This commit is contained in:
1 parent
54c7b83029
commit
ef50fa0620
84 files changed
+9188
No files matched your search
@@ -0,0 +1,78 @@
|
||||
/***
|
||||
* _ooOoo_
|
||||
* o8888888o
|
||||
* 88" . "88
|
||||
* (| -_- |)
|
||||
* O\ = /O
|
||||
* ____/`---'\____
|
||||
* . ' \\| |// `.
|
||||
* / \\||| : |||// \
|
||||
* / _||||| -:- |||||- \
|
||||
* | | \\\ - /// | |
|
||||
* | \_| ''\---/'' | |
|
||||
* \ .-\__ `-` ___/-. /
|
||||
* ___`. .' /--.--\ `. . __
|
||||
* ."" '< `.___\_<|>_/___.' >'"".
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
|
||||
* \ \ `-. \_ __\ /__ _/ .-` / /
|
||||
* ======`-.____`-.___\_____/___.-`____.-'======
|
||||
* `=---='
|
||||
*
|
||||
* .............................................
|
||||
* 佛祖保佑 永无BUG
|
||||
* 快加工资 不改需求
|
||||
*/
|
||||
|
||||
|
||||
using Autofac;
|
||||
using MAX.Core.DependencyInjection;
|
||||
using MAX.Core.Infrastructure;
|
||||
using MAX.Core.Reflections;
|
||||
using MediatR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MAX.Core;
|
||||
|
||||
public class Startup : IStartup
|
||||
{
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Register(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterInstance(LazyServiceProvider.Instance).As<ILazyServiceProvider>().AsSelf().SingleInstance();
|
||||
|
||||
#region 注册MediatR
|
||||
Assembly[] assemblies = AppTypeFinder.Assemblies.ToArray();
|
||||
|
||||
builder.RegisterType<MediatorManager>().As<IMediator>().AsSelf().SingleInstance();
|
||||
|
||||
builder.RegisterAssemblyTypes(assemblies)
|
||||
.AsClosedTypesOf(typeof(INotificationHandler<>))
|
||||
.AsImplementedInterfaces()
|
||||
.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
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user