ServiceCollectionMap.TryAdd 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
TryAdd(Type, Func<IServiceProvider,Object>, ServiceLifetime) |
Adds a service implemented by the given factory if no service for the given service type has already been registered. |
TryAdd(Type, Type, ServiceLifetime) |
Adds a service implemented by the given concrete type if no service for the given service type has already been registered. |
TryAdd(Type, Func<IServiceProvider,Object>, ServiceLifetime)
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
Adds a service implemented by the given factory if no service for the given service type has already been registered.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAdd (Type serviceType, Func<IServiceProvider,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
abstract member TryAdd : Type * Func<IServiceProvider, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAdd : Type * Func<IServiceProvider, obj> * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAdd (serviceType As Type, factory As Func(Of IServiceProvider, Object), lifetime As ServiceLifetime) As ServiceCollectionMap
Parameters
- serviceType
- Type
The contract for the service.
- factory
- Func<IServiceProvider,Object>
The factory that implements the service.
- lifetime
- ServiceLifetime
The service lifetime.
Returns
The map, such that further calls can be chained.
Applies to
TryAdd(Type, Type, ServiceLifetime)
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
- Source:
- ServiceCollectionMap.cs
Adds a 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 TryAdd (Type serviceType, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);
abstract member TryAdd : Type * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAdd : Type * Type * Microsoft.Extensions.DependencyInjection.ServiceLifetime -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAdd (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
Entity Framework