增加项目,分层

This commit is contained in:
chfei committed 2026-09-11 19:11:12 +08:00
1 parent 6e995a5bdb
commit 0a3e5af6a9
234 files changed
+26994 -1

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
using Autofac;
using MAX.Core;
using MAX.Core.Autofac;
using MAX.Core.DependencyInjection;
using MAX.Core.Infrastructure;
using MAX.Core.Logger;
using MAX.Core.Reflections;
using MAX.Framework.Logger;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace MAX.Framework;
public class Startup : IStartup
{
public int Priority => int.MaxValue - 1;
public void Initialize()
{
}
public void Register(ContainerBuilder builder)
{
#region 注册所有IOC接口
Assembly[] assemblies = AppTypeFinder.Assemblies.ToArray();
Type typeSingleton = typeof(ISingletonDependency);
builder.RegisterAssemblyTypes(assemblies)
.Where(a =>
typeSingleton.IsAssignableFrom(a)
&& a.IsClass
&& !a.IsAbstract
)
.AsImplementedInterfaces()
.AsSelf()
.SingleInstance();
Type typeTransient = typeof(ITransientDependency);
builder.RegisterAssemblyTypes(assemblies)
.Where(a =>
typeTransient.IsAssignableFrom(a)
&& a.IsClass
&& !a.IsAbstract
)
.AsImplementedInterfaces()
.AsSelf()
.InstancePerDependency();
#endregion
}
}