ServiceCollectionMap.TryAddTransient Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryAddTransient(Type, Func<IServiceProvider,Object>) |
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered. |
TryAddTransient(Type, Type) |
Adds a Transient service implemented by the given concrete type if no service for the given service type has already been registered. |
TryAddTransient<TService,TImplementation>(Func<IServiceProvider,TImplementation>) |
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered. |
TryAddTransient<TService,TImplementation>() |
Adds a Transient service implemented by the given concrete type if no service for the given service type has already been registered. |
TryAddTransient<TService>(Func<IServiceProvider,TService>) |
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered. |
TryAddTransient(Type, Func<IServiceProvider,Object>)
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient (Type serviceType, Func<IServiceProvider,object> factory);
abstract member TryAddTransient : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddTransient : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddTransient (serviceType As Type, factory As Func(Of IServiceProvider, Object)) As ServiceCollectionMap
Parameters
- serviceType
- Type
The contract for the service.
- factory
- Func<IServiceProvider,Object>
The factory that implements the service.
Returns
The map, such that further calls can be chained.
Applies to
TryAddTransient(Type, Type)
Adds a Transient service implemented by the given concrete type if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient (Type serviceType, Type implementationType);
abstract member TryAddTransient : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddTransient : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddTransient (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
TryAddTransient<TService,TImplementation>(Func<IServiceProvider,TImplementation>)
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService,TImplementation> (Func<IServiceProvider,TImplementation> factory) where TService : class where TImplementation : class, TService;
abstract member TryAddTransient : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(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 the given factory creates.
Parameters
- factory
- Func<IServiceProvider,TImplementation>
The factory that implements the service.
Returns
The map, such that further calls can be chained.
Applies to
TryAddTransient<TService,TImplementation>()
Adds a Transient service implemented by the given concrete type if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService,TImplementation> () where TService : class where TImplementation : class, TService;
abstract member TryAddTransient : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(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
TryAddTransient<TService>(Func<IServiceProvider,TService>)
Adds a Transient service implemented by the given factory if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService> (Func<IServiceProvider,TService> factory) where TService : class;
abstract member TryAddTransient : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(Of TService As Class) (factory As Func(Of IServiceProvider, TService)) As ServiceCollectionMap
Type Parameters
- TService
The contract for the service.
Parameters
- factory
- Func<IServiceProvider,TService>
The factory that implements the service.
Returns
The map, such that further calls can be chained.
Applies to
Entity Framework