增加Prism 框架

This commit is contained in:
chfei committed 2026-08-31 16:28:23 +08:00
1 parent 2cd6b8db86
commit 726eb6de16
99 files changed
+12527

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
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()
.PropertiesAutowired(new CustomPropertySelector())
.SingleInstance();
Type typeTransient = typeof(ITransientDependency);
builder.RegisterAssemblyTypes(assemblies)
.Where(a =>
typeTransient.IsAssignableFrom(a)
&& a.IsClass
&& !a.IsAbstract
)
.AsImplementedInterfaces()
.AsSelf()
.PropertiesAutowired(new CustomPropertySelector())
.InstancePerDependency();
#endregion
}
}