Class AmbientServicesExtensions
Extension methods for IAmbientServices.
Inheritance
Inherited Members
Namespace: Kephas
Assembly: Kephas.Core.dll
Syntax
public static class AmbientServicesExtensions
Methods
| Improve this Doc View SourceGetLogger(IAmbientServices, String)
Gets the logger with the provided name.
Declaration
public static ILogger GetLogger(this IAmbientServices ambientServices, string loggerName)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.String | loggerName | Name of the logger. |
Returns
Type | Description |
---|---|
ILogger | A logger for the provided name. |
GetLogger(IAmbientServices, Type)
Gets the logger for the provided type.
Declaration
public static ILogger GetLogger(this IAmbientServices ambientServices, Type type)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | type | The type. |
Returns
Type | Description |
---|---|
ILogger | A logger for the provided type. |
GetLogger<T>(IAmbientServices)
Gets the logger for the provided type.
Declaration
public static ILogger GetLogger<T>(this IAmbientServices ambientServices)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
Returns
Type | Description |
---|---|
ILogger | A logger for the provided type. |
Type Parameters
Name | Description |
---|---|
T | The type for which a logger should be created. |
GetRequiredService(IServiceProvider, Type)
Gets the service with the provided type.
Declaration
public static object GetRequiredService(this IServiceProvider ambientServices, Type serviceType)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
Returns
Type | Description |
---|---|
System.Object | A service object of type |
GetRequiredService<TService>(IServiceProvider)
Gets the service with the provided type.
Declaration
public static TService GetRequiredService<TService>(this IServiceProvider ambientServices)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | ambientServices | The ambient services to act on. |
Returns
Type | Description |
---|---|
TService | A service object of type |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
GetService<TService>(IServiceProvider)
Gets the service with the provided type.
Declaration
public static TService GetService<TService>(this IServiceProvider ambientServices)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | ambientServices | The ambient services to act on. |
Returns
Type | Description |
---|---|
TService | A service object of type |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
Register(IAmbientServices, Type, Func<Object>)
Registers the provided service as singleton factory.
Declaration
public static IAmbientServices Register(this IAmbientServices ambientServices, Type serviceType, Func<object> serviceFactory)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
System.Func<System.Object> | serviceFactory | The service factory. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Register(IAmbientServices, Type, Object)
Registers the provided service.
Declaration
public static IAmbientServices Register(this IAmbientServices ambientServices, Type serviceType, object service)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
System.Object | service | The service. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the requested operation is invalid. |
Register(IAmbientServices, Type, Type)
Registers the provided service as singleton.
Declaration
public static IAmbientServices Register(this IAmbientServices ambientServices, Type serviceType, Type serviceImplementationType)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
System.Type | serviceImplementationType | The service implementation type. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Register<TService>(IAmbientServices, TService)
Registers the provided service instance.
Declaration
public static IAmbientServices Register<TService>(this IAmbientServices ambientServices, TService service)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
TService | service | The service. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
Register<TService>(IAmbientServices, Action<IServiceRegistrationBuilder>)
Registers the provided service.
Declaration
public static IAmbientServices Register<TService>(this IAmbientServices ambientServices, Action<IServiceRegistrationBuilder> builder)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Action<IServiceRegistrationBuilder> | builder | The registration builder. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
Register<TService>(IAmbientServices, Func<TService>)
Registers the provided service as singleton factory.
Declaration
public static IAmbientServices Register<TService>(this IAmbientServices ambientServices, Func<TService> serviceFactory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Func<TService> | serviceFactory | The service factory. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
Register<TService, TServiceImplementation>(IAmbientServices)
Registers the provided service with implementation type as singleton.
Declaration
public static IAmbientServices Register<TService, TServiceImplementation>(this IAmbientServices ambientServices)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TServiceImplementation | Type of the service implementation. |
RegisterTransient(IAmbientServices, Type, Func<Object>)
Registers the provided service as transient factory.
Declaration
public static IAmbientServices RegisterTransient(this IAmbientServices ambientServices, Type serviceType, Func<object> serviceFactory)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
System.Func<System.Object> | serviceFactory | The service factory. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
RegisterTransient(IAmbientServices, Type, Type)
Registers the provided service as transient.
Declaration
public static IAmbientServices RegisterTransient(this IAmbientServices ambientServices, Type serviceType, Type serviceImplementationType)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Type | serviceType | Type of the service. |
System.Type | serviceImplementationType | The service implementation type. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
RegisterTransient<TService>(IAmbientServices, Func<TService>)
Registers the provided service as transient factory.
Declaration
public static IAmbientServices RegisterTransient<TService>(this IAmbientServices ambientServices, Func<TService> serviceFactory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Func<TService> | serviceFactory | The service factory. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
RegisterTransient<TService, TServiceImplementation>(IAmbientServices)
Registers the provided service with implementation type as singleton.
Declaration
public static IAmbientServices RegisterTransient<TService, TServiceImplementation>(this IAmbientServices ambientServices)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
Returns
Type | Description |
---|---|
IAmbientServices | The IAmbientServices. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TServiceImplementation | Type of the service implementation. |
WithAppRuntime(IAmbientServices, IAppRuntime)
Sets the application runtime to the ambient services.
Declaration
public static IAmbientServices WithAppRuntime(this IAmbientServices ambientServices, IAppRuntime appRuntime)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
IAppRuntime | appRuntime | The application runtime. |
Returns
Type | Description |
---|---|
IAmbientServices | This ambient services builder. |
WithCompositionContainer(IAmbientServices, ICompositionContext)
Sets the composition container to the ambient services.
Declaration
public static IAmbientServices WithCompositionContainer(this IAmbientServices ambientServices, ICompositionContext compositionContainer)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
ICompositionContext | compositionContainer | The composition container. |
Returns
Type | Description |
---|---|
IAmbientServices | This ambient services builder. |
WithCompositionContainer<TContainerBuilder>(IAmbientServices, Action<TContainerBuilder>)
Sets the composition container to the ambient services.
Declaration
public static IAmbientServices WithCompositionContainer<TContainerBuilder>(this IAmbientServices ambientServices, Action<TContainerBuilder> containerBuilderConfig = null)
where TContainerBuilder : ICompositionContainerBuilder
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
System.Action<TContainerBuilder> | containerBuilderConfig | The container builder configuration. |
Returns
Type | Description |
---|---|
IAmbientServices | This ambient services builder. |
Type Parameters
Name | Description |
---|---|
TContainerBuilder | Type of the composition container builder. |
Remarks
The container builder type must provide a constructor with one parameter of type IContext.
WithConfigurationStore(IAmbientServices, IConfigurationStore)
Sets the configuration store to the ambient services.
Declaration
public static IAmbientServices WithConfigurationStore(this IAmbientServices ambientServices, IConfigurationStore configurationStore)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
IConfigurationStore | configurationStore | The configuration store. |
Returns
Type | Description |
---|---|
IAmbientServices | The provided ambient services. |
WithLiteCompositionContainer(IAmbientServices, Action<LiteCompositionContainerBuilder>)
Sets the Lite composition container to the ambient services.
Declaration
public static IAmbientServices WithLiteCompositionContainer(this IAmbientServices ambientServices, Action<LiteCompositionContainerBuilder> containerBuilderConfig = null)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services. |
System.Action<LiteCompositionContainerBuilder> | containerBuilderConfig | The container builder configuration. |
Returns
Type | Description |
---|---|
IAmbientServices | The provided ambient services builder. |
WithLogManager(IAmbientServices, ILogManager)
Sets the log manager to the ambient services.
Declaration
public static IAmbientServices WithLogManager(this IAmbientServices ambientServices, ILogManager logManager)
Parameters
Type | Name | Description |
---|---|---|
IAmbientServices | ambientServices | The ambient services to act on. |
ILogManager | logManager | The log manager. |
Returns
Type | Description |
---|---|
IAmbientServices | This ambient services builder. |