Show / Hide Table of Contents

Class AmbientServicesExtensions

Extension methods for IAmbientServices.

Inheritance
System.Object
AmbientServicesExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas
Assembly: Kephas.Core.dll
Syntax
public static class AmbientServicesExtensions

Methods

| Improve this Doc View Source

GetLogger(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 serviceType.

| Improve this Doc View Source

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 TService.-or- null if there is no service object of type TService.

Type Parameters
Name Description
TService

Type of the service.

| Improve this Doc View Source

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 TService.-or- null if there is no service object of type TService.

Type Parameters
Name Description
TService

Type of the service.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX