ServiceCollectionMap.TryAddEnumerable Method

Definition

Overloads

TryAddEnumerable(Type, Type, ServiceLifetime)

Adds a 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.

TryAddEnumerable(Type, Type, Func<IServiceProvider,Object>, ServiceLifetime)

Adds a 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.

TryAddEnumerable(Type, Type, ServiceLifetime)

Adds a 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 TryAddEnumerable (Type serviceType, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
abstract member TryAddEnumerable : Type * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddEnumerable : Type * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddEnumerable (serviceType As Type, implementationType As Type, lifetime As ServiceLifetime) As ServiceCollectionMap

Parameters

serviceType
Type

The contract for the service.

implementationType
Type

The concrete type that implements the service.

lifetime
ServiceLifetime

The service lifetime.

Returns

The map, such that further calls can be chained.

Applies to

TryAddEnumerable(Type, Type, Func<IServiceProvider,Object>, ServiceLifetime)

Adds a 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 TryAddEnumerable (Type serviceType, Type implementationType, Func<IServiceProvider,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
abstract member TryAddEnumerable : Type * Type * Func<IServiceProvider, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddEnumerable : Type * Type * Func<IServiceProvider, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddEnumerable (serviceType As Type, implementationType As Type, factory As Func(Of IServiceProvider, Object), lifetime As ServiceLifetime) As ServiceCollectionMap

Parameters

serviceType
Type

The contract for the service.

implementationType
Type

The concrete type that implements the service.

factory
Func<IServiceProvider,Object>

The factory that implements this service.

lifetime
ServiceLifetime

The service lifetime.

Returns

The map, such that further calls can be chained.

Applies to