GAppServices Class

提供用来获取已注册服务的静态方法。

Definition

Namespace: QuickAdmin.Common
Assembly: QuickAdmin.Net (in QuickAdmin.Net.dll) Version: 2.0.13
C#
public static class AppServices
Inheritance
object    GAppServices

Remarks

提供了各种获取已注册服务的方法,包括获取已知类型的服务、获取动态类型的服务、获取 Scoped 服务、获取 Keyed Services 等等。
其中各个 GetRequiredXXXAppServiceGetXXXAppService 的区别是:当服务未找到时,前者会抛出 InvalidOperationException 异常,后者则返回 null
支持在 HTTP 上下文以及非 HTTP 上下文中进行调用。

Methods

Public Methods

FindAppServiceByBaseGenericInterfaceOfType 在已注册服务中查找一个服务,该服务的服务类型是指定类型 type 继承或实现的一个泛型接口。
FindAppServiceByBaseInterfaceOfType 在已注册服务中查找一个服务,该服务的服务类型是指定类型 type 继承或实现的一个接口。
FindAppServiceByBaseNonGenericInterfaceOfType 在已注册服务中查找一个服务,该服务的服务类型是指定类型 type 继承或实现的一个非泛型接口。
FindScopedAppServiceByBaseGenericInterfaceOfType 在已注册服务中查找一个生命周期为 Scoped 的服务,该服务的服务类型是指定类型 type 继承或实现的一个泛型接口。
FindScopedAppServiceByBaseInterfaceOfType 在已注册服务中查找一个生命周期为 Scoped 的服务,该服务的服务类型是指定类型 type 继承或实现的一个接口。
FindScopedAppServiceByBaseNonGenericInterfaceOfType 在已注册服务中查找一个生命周期为 Scoped 的服务,该服务的服务类型是指定类型 type 继承或实现的一个非泛型接口。
GetAppService(Type, Type) 从已注册服务中获取指定类型的服务,可指定其父类型。
GetAppServiceT 从已注册服务中获取指定类型的服务。
GetAppServiceTService, TImplementation 从已注册服务中获取指定类型的指定实现的服务。
GetKeyedAppService(Type, object, Type) 从已注册服务中获取具有指定 Key 的指定类型的服务,可指定其父类型。
GetKeyedAppServiceT(object) 从已注册服务中获取具有指定 Key 的指定类型的服务。
GetKeyedAppServiceTService, TImplementation(object) 从已注册服务中获取具有指定 Key 的,指定类型、指定实现的服务。
GetRequiredAppService(Type, Type) 从已注册服务中获取指定类型的服务,可指定其父类型。若未找到将抛出异常。
GetRequiredAppServiceT 从已注册服务中获取指定类型的服务,若未找到将抛出异常。
GetRequiredAppServiceTService, TImplementation 从已注册服务中获取指定类型的指定实现的服务,若未找到将抛出异常。
GetRequiredKeyedAppService(Type, object, Type) 从已注册服务中获取具有指定 Key 的指定类型的服务,可指定其父类型。若未找到将抛出异常。
GetRequiredKeyedAppServiceT(object) 从已注册服务中获取具有指定 Key 的指定类型的服务,若未找到将抛出异常。
GetRequiredKeyedAppServiceTService, TImplementation(object) 从已注册服务中获取具有指定 Key 的,指定类型、指定实现的服务,若未找到将抛出异常。
GetRequiredScopedAppService(Type, Type) 从已注册服务中获取生命周期为 Scoped 的指定类型的服务,可指定其父类型。若未找到将抛出异常。
GetRequiredScopedAppServiceT 从已注册服务中获取生命周期为 Scoped 的指定类型的服务,若未找到将抛出异常。
GetRequiredScopedAppServiceTService, TImplementation 从已注册服务中获取生命周期为 Scoped 的指定类型的指定实现的服务,若未找到将抛出异常。
GetRequiredScopedKeyedAppService(Type, object, Type) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的指定类型的服务,可指定其父类型。若未找到将抛出异常。
GetRequiredScopedKeyedAppServiceT(object) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的指定类型的服务,若未找到将抛出异常。
GetRequiredScopedKeyedAppServiceTService, TImplementation(object) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的,指定类型、指定实现的服务,若未找到将抛出异常。
GetScopedAppService(Type, Type) 从已注册服务中获取生命周期为 Scoped 的指定类型的服务,可指定其父类型。
GetScopedAppServiceT 从已注册服务中获取生命周期为 Scoped 的指定类型的服务。
GetScopedAppServiceTService, TImplementation 从已注册服务中获取生命周期为 Scoped 的指定类型的指定实现的服务。
GetScopedKeyedAppService(Type, object, Type) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的指定类型的服务,可指定其父类型。
GetScopedKeyedAppServiceT(object) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的指定类型的服务。
GetScopedKeyedAppServiceTService, TImplementation(object) 从已注册服务中获取生命周期为 Scoped 的,具有指定 Key 的,指定类型、指定实现的服务。

See Also