語言

ServiceCollectionMap.TryAddScoped 方法

定義

多載

名稱 Description
TryAddScoped(Type, Func<IServiceProvider,Object>)

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

TryAddScoped(Type, Type)

若尚未註冊該具體類型的服務,則新增 Scoped 由該具體類型實作的服務。

TryAddScoped<TService,TImplementation>()

若尚未註冊該具體類型的服務,則新增 Scoped 由該具體類型實作的服務。

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

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

TryAddScoped<TService>(Func<IServiceProvider,TService>)

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

TryAddScoped(Type, Func<IServiceProvider,Object>)

來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddScoped(Type serviceType, Func<IServiceProvider,object> factory);
abstract member TryAddScoped : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddScoped : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddScoped (serviceType As Type, factory As Func(Of IServiceProvider, Object)) As ServiceCollectionMap

參數

serviceType
Type

服務合約。

factory
Func<IServiceProvider,Object>

實作這項服務的工廠。

傳回

映射,使得後續呼叫可以串連起來。

適用於

TryAddScoped(Type, Type)

來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs

若尚未註冊該具體類型的服務,則新增 Scoped 由該具體類型實作的服務。

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

參數

serviceType
Type

服務合約。

implementationType
Type

就是實作服務的具體類型。

傳回

映射,使得後續呼叫可以串連起來。

適用於

TryAddScoped<TService,TImplementation>()

來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs

若尚未註冊該具體類型的服務,則新增 Scoped 由該具體類型實作的服務。

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

類型參數

TService

服務合約。

TImplementation

就是實作服務的具體類型。

傳回

映射,使得後續呼叫可以串連起來。

適用於

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

來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

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

類型參數

TService

服務合約。

TImplementation

就是該工廠所製造的混凝土類型。

參數

factory
Func<IServiceProvider,TImplementation>

實作這項服務的工廠。

傳回

映射,使得後續呼叫可以串連起來。

適用於

TryAddScoped<TService>(Func<IServiceProvider,TService>)

來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs
來源:
ServiceCollectionMap.cs

若該工廠尚未註冊該服務類型,則新增 Scoped 該工廠實作的服務。

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

類型參數

TService

服務合約。

參數

factory
Func<IServiceProvider,TService>

實作這項服務的工廠。

傳回

映射,使得後續呼叫可以串連起來。

適用於