Share via


ServiceCollectionMap.TryAddSingletonEnumerable Method

Definition

Overloads

TryAddSingletonEnumerable(Type, Object)

Adds a Singleton service implemented by the given instance to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

TryAddSingletonEnumerable(Type, Type)

Adds a Singleton service implemented by the given concrete type to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

TryAddSingletonEnumerable<TService,TImplementation>()

Adds a Singleton service implemented by the given concrete type to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

TryAddSingletonEnumerable<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

Adds a Singleton service implemented by the given factory to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

TryAddSingletonEnumerable<TService>(TService)

Adds a Singleton service implemented by the given instance to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

TryAddSingletonEnumerable(Type, Object)

Adds a Singleton service implemented by the given instance to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddSingletonEnumerable (Type serviceType, object implementation);
abstract member TryAddSingletonEnumerable : Type * obj -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddSingletonEnumerable : Type * obj -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddSingletonEnumerable (serviceType As Type, implementation As Object) As ServiceCollectionMap

Parameters

serviceType
Type

The contract for the service.

implementation
Object

The object that implements the service.

Returns

The map, such that further calls can be chained.

Applies to

TryAddSingletonEnumerable(Type, Type)

Adds a Singleton service implemented by the given concrete type to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddSingletonEnumerable (Type serviceType, Type implementationType);
abstract member TryAddSingletonEnumerable : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddSingletonEnumerable : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddSingletonEnumerable (serviceType As Type, implementationType As Type) As ServiceCollectionMap

Parameters

serviceType
Type

The contract for the service.

implementationType
Type

The concrete type that implements the service.

Returns

The map, such that further calls can be chained.

Applies to

TryAddSingletonEnumerable<TService,TImplementation>()

Adds a Singleton service implemented by the given concrete type to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddSingletonEnumerable<TService,TImplementation> () where TService : class where TImplementation : class, TService;
abstract member TryAddSingletonEnumerable : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddSingletonEnumerable : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddSingletonEnumerable(Of TService As Class, TImplementation As Class) () As ServiceCollectionMap

Type Parameters

TService

The contract for the service.

TImplementation

The concrete type that implements the service.

Returns

The map, such that further calls can be chained.

Applies to

TryAddSingletonEnumerable<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

Adds a Singleton service implemented by the given factory to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddSingletonEnumerable<TService,TImplementation> (Func<IServiceProvider,TImplementation> factory) where TService : class where TImplementation : class, TService;
abstract member TryAddSingletonEnumerable : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddSingletonEnumerable : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddSingletonEnumerable(Of TService As Class, TImplementation As Class) (factory As Func(Of IServiceProvider, TImplementation)) As ServiceCollectionMap

Type Parameters

TService

The contract for the service.

TImplementation

The concrete type that implements the service.

Parameters

factory
Func<IServiceProvider,TImplementation>

The factory that implements this service.

Returns

The map, such that further calls can be chained.

Applies to

TryAddSingletonEnumerable<TService>(TService)

Adds a Singleton service implemented by the given instance to the list of services that implement the given contract. The service is only added if the collection contains no other registration for the same service and implementation type.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddSingletonEnumerable<TService> (TService implementation) where TService : class;
abstract member TryAddSingletonEnumerable : 'Service -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddSingletonEnumerable : 'Service -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddSingletonEnumerable(Of TService As Class) (implementation As TService) As ServiceCollectionMap

Type Parameters

TService

The contract for the service.

Parameters

implementation
TService

The object that implements the service.

Returns

The map, such that further calls can be chained.

Applies to