添加项目文件。
This commit is contained in:
1 parent
6a017c9547
commit
58abbb5b4f
86 files changed
+8729
No files matched your search
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace MAX.Core.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注册抽象(由 MAX.Core 自己定义,不依赖任何第三方 DI 容器)。
|
||||
/// 具体实现由宿主项目提供,内部适配外部容器(Autofac、Microsoft.Extensions.DependencyInjection 等)。
|
||||
/// </summary>
|
||||
public interface IServiceRegistrar
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册单例:<typeparamref name="TImplementation"/> 实现 <typeparamref name="TService"/>
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册单例实例
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService>(TService instance) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册单例(匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService>(Func<IServiceProvider, TService> factory) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册单例(key):<typeparamref name="TImplementation"/> 实现 <typeparamref name="TService"/>
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册单例实例(key)
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService>(object? serviceKey, TService instance) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册单例(key + 匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterSingleton<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> factory) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册作用域生命周期
|
||||
/// </summary>
|
||||
void RegisterScoped<TService, TImplementation>() where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册作用域生命周期(匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterScoped<TService>(Func<IServiceProvider, TService> factory) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册作用域生命周期(key):<typeparamref name="TImplementation"/> 实现 <typeparamref name="TService"/>
|
||||
/// </summary>
|
||||
void RegisterScoped<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册作用域生命周期(key + 匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterScoped<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> factory) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册瞬时生命周期
|
||||
/// </summary>
|
||||
void RegisterTransient<TService, TImplementation>() where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册瞬时生命周期(匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterTransient<TService>(Func<IServiceProvider, TService> factory) where TService : class;
|
||||
|
||||
/// <summary>
|
||||
/// 注册瞬时生命周期(key):<typeparamref name="TImplementation"/> 实现 <typeparamref name="TService"/>
|
||||
/// </summary>
|
||||
void RegisterTransient<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService;
|
||||
|
||||
/// <summary>
|
||||
/// 注册瞬时生命周期(key + 匿名工厂)
|
||||
/// </summary>
|
||||
void RegisterTransient<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> factory) where TService : class;
|
||||
}
|
||||
Reference in new issue
Block a user