ServiceCollectionDescriptorExtensions 類別

定義

用於在 IServiceCollection 中新增和移除服務的擴充方法。

public ref class ServiceCollectionDescriptorExtensions abstract sealed
public static class ServiceCollectionDescriptorExtensions
type ServiceCollectionDescriptorExtensions = class
Public Module ServiceCollectionDescriptorExtensions
繼承
ServiceCollectionDescriptorExtensions

方法

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceDescriptor 的序列新增至 collection

Add(IServiceCollection, ServiceDescriptor)

將指定的 descriptor 加入至 collection

RemoveAll(IServiceCollection, Type)

移除 IServiceCollectionserviceType 類型的所有服務。

RemoveAll<T>(IServiceCollection)

移除 IServiceCollectionT 類型的所有服務。

RemoveAllKeyed(IServiceCollection, Type, Object)

移除 collectionserviceType 類型的所有服務。

RemoveAllKeyed<T>(IServiceCollection, Object)

移除 collectionT 類型的所有服務。

Replace(IServiceCollection, ServiceDescriptor)

移除 IServiceCollection 中具有與 descriptor 相同服務類型的第一個服務,並將 descriptor 新增至集合。

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果尚未註冊服務類型,則將指定的 descriptors 新增至 collection

TryAdd(IServiceCollection, ServiceDescriptor)

如果尚未註冊服務類型,則將指定的 descriptor 新增至 collection

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果現有描述項具有相同的 ServiceType,以及尚未存在於 services 中的實作,則新增特定的 ServiceDescriptor

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

如果現有描述項具有相同的 ServiceType,以及尚未存在於 services 中的實作,則新增 ServiceDescriptor

TryAddKeyedScoped(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Scoped 服務新增至 collection

TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Scoped 服務新增至 collection

TryAddKeyedScoped(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeScoped 服務新增至 collection

TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Scoped 服務實作類型新增至 collection

TryAddKeyedScoped<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Scoped 服務新增至 collection

TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Scoped 服務新增至 services

TryAddKeyedSingleton(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeSingleton 服務新增至 collection

TryAddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Singleton 服務實作類型新增至 collection

TryAddKeyedSingleton<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Singleton 服務新增至 services

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

如果尚未註冊服務類型,則使用 instance 中指定的執行個體,將指定的 TService 作為 Singleton 服務新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Transient 服務新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Transient 服務新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeTransient 服務新增至 collection

TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Transient 服務實作類型新增至 collection

TryAddKeyedTransient<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Transient 服務新增至 collection

TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Transient 服務新增至 services

TryAddScoped(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Scoped 服務新增至 collection

TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Scoped 服務新增至 collection

TryAddScoped(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeScoped 服務新增至 collection

TryAddScoped<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Scoped 服務實作類型新增至 collection

TryAddScoped<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Scoped 服務新增至 collection

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

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Scoped 服務新增至 services

TryAddSingleton(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Singleton 服務新增至 collection

TryAddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Singleton 服務新增至 collection

TryAddSingleton(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeSingleton 服務新增至 collection

TryAddSingleton<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Singleton 服務實作類型新增至 collection

TryAddSingleton<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Singleton 服務新增至 collection

TryAddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Singleton 服務新增至 services

TryAddSingleton<TService>(IServiceCollection, TService)

如果尚未註冊服務類型,則使用 instance 中指定的執行個體,將指定的 TService 作為 Singleton 服務新增至 collection

TryAddTransient(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Transient 服務新增至 collection

TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Transient 服務新增至 collection

TryAddTransient(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeTransient 服務新增至 collection

TryAddTransient<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Transient 服務實作類型新增至 collection

TryAddTransient<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Transient 服務新增至 collection

TryAddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Transient 服務新增至 services

適用於