Share via


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)

删除 IServiceCollection 中所有 serviceType 类型的服务。

RemoveAll<T>(IServiceCollection)

删除 IServiceCollection 中所有 T 类型的服务。

RemoveAllKeyed(IServiceCollection, Type, Object)

删除 collection 中所有 serviceType 类型的服务。

RemoveAllKeyed<T>(IServiceCollection, Object)

删除 collection 中所有 T 类型的服务。

Replace(IServiceCollection, ServiceDescriptor)

删除 IServiceCollection 中与 descriptor 的服务类型相同的第一个服务,并将 descriptor 添加到集合中。

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果服务类型尚未注册,则将指定的 descriptors 添加到 collection 中。

TryAdd(IServiceCollection, ServiceDescriptor)

如果服务类型尚未注册,则将指定的 descriptor 添加到 collection 中。

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加指定的 ServiceDescriptor

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

如果现有描述符具有相同 ServiceTypeservices 中尚不存在的实现,则添加 ServiceDescriptor

TryAddKeyedScoped(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Scoped 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddKeyedScoped(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Scoped 服务添加到 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 中指定的中心将指定的 TService 作为 Scoped 服务添加到 services 中。

TryAddKeyedSingleton(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Singleton 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Singleton 服务添加到 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 中指定的中心将指定的 TService 作为 Singleton 服务添加到 services 中。

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

如果服务类型尚未注册,则将指定的 TService 作为包含 instance 中指定的实例的 Singleton 服务添加到 collection 中。

TryAddKeyedTransient(IServiceCollection, Type, Object)

如果服务类型尚未注册,则将指定的 service 作为 Transient 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddKeyedTransient(IServiceCollection, Type, Object, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Transient 服务添加到 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 中指定的中心将指定的 TService 作为 Transient 服务添加到 services 中。

TryAddScoped(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Scoped 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddScoped(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Scoped 服务添加到 collection 中。

TryAddScoped<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Scoped 服务实现类型添加到 collection 中。

TryAddScoped<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Scoped 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Scoped 服务添加到 services 中。

TryAddSingleton(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Singleton 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddSingleton(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Singleton 服务添加到 collection 中。

TryAddSingleton<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Singleton 服务实现类型添加到 collection 中。

TryAddSingleton<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Singleton 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Singleton 服务添加到 services 中。

TryAddSingleton<TService>(IServiceCollection, TService)

如果服务类型尚未注册,则将指定的 TService 作为包含 instance 中指定的实例的 Singleton 服务添加到 collection 中。

TryAddTransient(IServiceCollection, Type)

如果服务类型尚未注册,则将指定的 service 作为 Transient 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddTransient(IServiceCollection, Type, Type)

如果服务类型尚未注册,则使用 implementationType 实现将指定的 service 作为 Transient 服务添加到 collection 中。

TryAddTransient<TService,TImplementation>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 TImplementation 中指定的 Transient 服务实现类型添加到 collection 中。

TryAddTransient<TService>(IServiceCollection)

如果服务类型尚未注册,则将指定的 TService 作为 Transient 服务添加到 collection 中。

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

如果服务类型尚未注册,则使用 implementationFactory 中指定的中心将指定的 TService 作为 Transient 服务添加到 services 中。

适用于