ServiceCollection ServiceCollection ServiceCollection Class

Definition

Default implementation of IServiceCollection.

public class ServiceCollection : Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.ICollection<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IList<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>
type ServiceCollection = class
    interface IServiceCollection
    interface IList<ServiceDescriptor>
    interface ICollection<ServiceDescriptor>
    interface seq<ServiceDescriptor>
    interface IEnumerable
Public Class ServiceCollection
Implements ICollection(Of ServiceDescriptor), IEnumerable(Of ServiceDescriptor), IList(Of ServiceDescriptor), IServiceCollection
Inheritance
ServiceCollectionServiceCollectionServiceCollection
Implements

Constructors

ServiceCollection() ServiceCollection() ServiceCollection()

Properties

Count Count Count
IsReadOnly IsReadOnly IsReadOnly
Item[Int32] Item[Int32] Item[Int32]

Methods

Clear() Clear() Clear()
Contains(ServiceDescriptor) Contains(ServiceDescriptor) Contains(ServiceDescriptor)
CopyTo(ServiceDescriptor[], Int32) CopyTo(ServiceDescriptor[], Int32) CopyTo(ServiceDescriptor[], Int32)
GetEnumerator() GetEnumerator() GetEnumerator()
IndexOf(ServiceDescriptor) IndexOf(ServiceDescriptor) IndexOf(ServiceDescriptor)
Insert(Int32, ServiceDescriptor) Insert(Int32, ServiceDescriptor) Insert(Int32, ServiceDescriptor)
Remove(ServiceDescriptor) Remove(ServiceDescriptor) Remove(ServiceDescriptor)
RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Explicit Interface Implementations

ICollection<ServiceDescriptor>.Add(ServiceDescriptor) ICollection<ServiceDescriptor>.Add(ServiceDescriptor) ICollection<ServiceDescriptor>.Add(ServiceDescriptor)
IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Extension Methods

AddHostFiltering(IServiceCollection, Action<HostFilteringOptions>) AddHostFiltering(IServiceCollection, Action<HostFilteringOptions>) AddHostFiltering(IServiceCollection, Action<HostFilteringOptions>)

Adds services and options for the host filtering middleware.

AddHsts(IServiceCollection, Action<HstsOptions>) AddHsts(IServiceCollection, Action<HstsOptions>) AddHsts(IServiceCollection, Action<HstsOptions>)

Adds HSTS services.

AddHttpsRedirection(IServiceCollection, Action<HttpsRedirectionOptions>) AddHttpsRedirection(IServiceCollection, Action<HttpsRedirectionOptions>) AddHttpsRedirection(IServiceCollection, Action<HttpsRedirectionOptions>)

Adds HTTPS redirection services.

AddResponseCompression(IServiceCollection) AddResponseCompression(IServiceCollection) AddResponseCompression(IServiceCollection)

Add response compression services.

AddResponseCompression(IServiceCollection, Action<ResponseCompressionOptions>) AddResponseCompression(IServiceCollection, Action<ResponseCompressionOptions>) AddResponseCompression(IServiceCollection, Action<ResponseCompressionOptions>)

Add response compression services and configure the related options.

GetWrapperProvider(IEnumerable<IWrapperProviderFactory>, WrapperProviderContext) GetWrapperProvider(IEnumerable<IWrapperProviderFactory>, WrapperProviderContext) GetWrapperProvider(IEnumerable<IWrapperProviderFactory>, WrapperProviderContext)

Gets an instance of IWrapperProvider for the supplied type.

RemoveType(IList<IMetadataDetailsProvider>, Type) RemoveType(IList<IMetadataDetailsProvider>, Type) RemoveType(IList<IMetadataDetailsProvider>, Type)

Removes all metadata details providers of the specified type.

RemoveType<TMetadataDetailsProvider>(IList<IMetadataDetailsProvider>) RemoveType<TMetadataDetailsProvider>(IList<IMetadataDetailsProvider>) RemoveType<TMetadataDetailsProvider>(IList<IMetadataDetailsProvider>)

Removes all metadata details providers of the specified type.

RemoveType(IList<IModelBinderProvider>, Type) RemoveType(IList<IModelBinderProvider>, Type) RemoveType(IList<IModelBinderProvider>, Type)

Removes all model binder providers of the specified type.

RemoveType<TModelBinderProvider>(IList<IModelBinderProvider>) RemoveType<TModelBinderProvider>(IList<IModelBinderProvider>) RemoveType<TModelBinderProvider>(IList<IModelBinderProvider>)

Removes all model binder providers of the specified type.

RemoveType(IList<IModelValidatorProvider>, Type) RemoveType(IList<IModelValidatorProvider>, Type) RemoveType(IList<IModelValidatorProvider>, Type)

Removes all model validator providers of the specified type.

RemoveType<TModelValidatorProvider>(IList<IModelValidatorProvider>) RemoveType<TModelValidatorProvider>(IList<IModelValidatorProvider>) RemoveType<TModelValidatorProvider>(IList<IModelValidatorProvider>)

Removes all model validator providers of the specified type.

RemoveType(IList<IValueProviderFactory>, Type) RemoveType(IList<IValueProviderFactory>, Type) RemoveType(IList<IValueProviderFactory>, Type)

Removes all value provider factories of the specified type.

RemoveType<TValueProviderFactory>(IList<IValueProviderFactory>) RemoveType<TValueProviderFactory>(IList<IValueProviderFactory>) RemoveType<TValueProviderFactory>(IList<IValueProviderFactory>)

Removes all value provider factories of the specified type.

FirstHtmlSymbolAs(IEnumerable<ISymbol>, HtmlSymbolType) FirstHtmlSymbolAs(IEnumerable<ISymbol>, HtmlSymbolType) FirstHtmlSymbolAs(IEnumerable<ISymbol>, HtmlSymbolType)

Converts the generic IEnumerable<T> to a IEnumerable<T> and finds the first HtmlSymbol with type type.

GetContent(IEnumerable<ISymbol>, SourceLocation) GetContent(IEnumerable<ISymbol>, SourceLocation) GetContent(IEnumerable<ISymbol>, SourceLocation)
AddMiddlewareAnalysis(IServiceCollection) AddMiddlewareAnalysis(IServiceCollection) AddMiddlewareAnalysis(IServiceCollection)

Adds diagnostic services to the specified IServiceCollection.

AddAntiforgery(IServiceCollection) AddAntiforgery(IServiceCollection) AddAntiforgery(IServiceCollection)

Adds antiforgery services to the specified IServiceCollection.

AddAntiforgery(IServiceCollection, Action<AntiforgeryOptions>) AddAntiforgery(IServiceCollection, Action<AntiforgeryOptions>) AddAntiforgery(IServiceCollection, Action<AntiforgeryOptions>)

Adds antiforgery services to the specified IServiceCollection.

Add(IList<IApplicationModelConvention>, IActionModelConvention) Add(IList<IApplicationModelConvention>, IActionModelConvention) Add(IList<IApplicationModelConvention>, IActionModelConvention)

Adds a IActionModelConvention to all the actions in the application.

Add(IList<IApplicationModelConvention>, IControllerModelConvention) Add(IList<IApplicationModelConvention>, IControllerModelConvention) Add(IList<IApplicationModelConvention>, IControllerModelConvention)

Adds a IControllerModelConvention to all the controllers in the application.

Add(IList<IApplicationModelConvention>, IParameterModelBaseConvention) Add(IList<IApplicationModelConvention>, IParameterModelBaseConvention) Add(IList<IApplicationModelConvention>, IParameterModelBaseConvention)

Adds a IParameterModelBaseConvention to all properties and parameters in the application.

Add(IList<IApplicationModelConvention>, IParameterModelConvention) Add(IList<IApplicationModelConvention>, IParameterModelConvention) Add(IList<IApplicationModelConvention>, IParameterModelConvention)

Adds a IParameterModelConvention to all the parameters in the application.

RemoveType(IList<IApplicationModelConvention>, Type) RemoveType(IList<IApplicationModelConvention>, Type) RemoveType(IList<IApplicationModelConvention>, Type)

Removes all application model conventions of the specified type.

RemoveType<TApplicationModelConvention>(IList<IApplicationModelConvention>) RemoveType<TApplicationModelConvention>(IList<IApplicationModelConvention>) RemoveType<TApplicationModelConvention>(IList<IApplicationModelConvention>)

Removes all application model conventions of the specified type.

AddAuthenticationCore(IServiceCollection) AddAuthenticationCore(IServiceCollection) AddAuthenticationCore(IServiceCollection)

Add core authentication services needed for IAuthenticationService.

AddAuthenticationCore(IServiceCollection, Action<AuthenticationOptions>) AddAuthenticationCore(IServiceCollection, Action<AuthenticationOptions>) AddAuthenticationCore(IServiceCollection, Action<AuthenticationOptions>)

Add core authentication services needed for IAuthenticationService.

AddAuthentication(IServiceCollection) AddAuthentication(IServiceCollection) AddAuthentication(IServiceCollection)

Adds authentication services to the specified IServiceCollection.

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>) AddAuthentication(IServiceCollection, Action<AuthenticationOptions>) AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)
AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>) AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>) AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)

Adds authentication services to the specified IServiceCollection.

AddAuthentication(IServiceCollection, String) AddAuthentication(IServiceCollection, String) AddAuthentication(IServiceCollection, String)
AddRemoteScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>) AddRemoteScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>) AddRemoteScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>)
AddScheme<TOptions,THandler>(IServiceCollection, String, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, Action<TOptions>)
AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<TOptions>)
AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<AuthenticationSchemeBuilder>, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<AuthenticationSchemeBuilder>, Action<TOptions>) AddScheme<TOptions,THandler>(IServiceCollection, String, String, Action<AuthenticationSchemeBuilder>, Action<TOptions>)
AddAuthorization(IServiceCollection) AddAuthorization(IServiceCollection) AddAuthorization(IServiceCollection)

Adds authorization services to the specified IServiceCollection.

AddAuthorization(IServiceCollection, Action<AuthorizationOptions>) AddAuthorization(IServiceCollection, Action<AuthorizationOptions>) AddAuthorization(IServiceCollection, Action<AuthorizationOptions>)

Adds authorization services to the specified IServiceCollection.

AddConnections(IServiceCollection) AddConnections(IServiceCollection) AddConnections(IServiceCollection)

Adds required services for ASP.NET Core Connection Handlers to the specified IServiceCollection.

AddCors(IServiceCollection) AddCors(IServiceCollection) AddCors(IServiceCollection)

Adds cross-origin resource sharing services to the specified IServiceCollection.

AddCors(IServiceCollection, Action<CorsOptions>) AddCors(IServiceCollection, Action<CorsOptions>) AddCors(IServiceCollection, Action<CorsOptions>)

Adds cross-origin resource sharing services to the specified IServiceCollection.

AddDataProtection(IServiceCollection) AddDataProtection(IServiceCollection) AddDataProtection(IServiceCollection)

Adds data protection services to the specified IServiceCollection.

AddDataProtection(IServiceCollection, Action<DataProtectionOptions>) AddDataProtection(IServiceCollection, Action<DataProtectionOptions>) AddDataProtection(IServiceCollection, Action<DataProtectionOptions>)

Adds data protection services to the specified IServiceCollection.

AddDirectoryBrowser(IServiceCollection) AddDirectoryBrowser(IServiceCollection) AddDirectoryBrowser(IServiceCollection)

Adds directory browser middleware services.

AddElm(IServiceCollection) AddElm(IServiceCollection) AddElm(IServiceCollection)

Adds error logging middleware services to the specified IServiceCollection.

AddElm(IServiceCollection, Action<ElmOptions>) AddElm(IServiceCollection, Action<ElmOptions>) AddElm(IServiceCollection, Action<ElmOptions>)

Adds error logging middleware services to the specified IServiceCollection.

AddWebEncoders(IServiceCollection) AddWebEncoders(IServiceCollection) AddWebEncoders(IServiceCollection)

Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>) AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>) AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>)

Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

Add(IServiceCollection, ServiceDescriptor) Add(IServiceCollection, ServiceDescriptor) Add(IServiceCollection, ServiceDescriptor)

Adds the specified descriptor to the collection.

Add(IServiceCollection, IEnumerable<ServiceDescriptor>) Add(IServiceCollection, IEnumerable<ServiceDescriptor>) Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

Adds a sequence of ServiceDescriptor to the collection.

RemoveAll(IServiceCollection, Type) RemoveAll(IServiceCollection, Type) RemoveAll(IServiceCollection, Type)

Removes all services of type in IServiceCollection.

RemoveAll<T>(IServiceCollection) RemoveAll<T>(IServiceCollection) RemoveAll<T>(IServiceCollection)

Removes all services of type in IServiceCollection.

Replace(IServiceCollection, ServiceDescriptor) Replace(IServiceCollection, ServiceDescriptor) Replace(IServiceCollection, ServiceDescriptor)

Removes the first service in IServiceCollection with the same service type as descriptor and adds to the collection.

TryAdd(IServiceCollection, ServiceDescriptor) TryAdd(IServiceCollection, ServiceDescriptor) TryAdd(IServiceCollection, ServiceDescriptor)

Adds the specified descriptor to the collection if the service type hasn't already been registered.

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>) TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>) TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

Adds the specified descriptors to the collection if the service type hasn't already been registered.

TryAddEnumerable(IServiceCollection, ServiceDescriptor) TryAddEnumerable(IServiceCollection, ServiceDescriptor) TryAddEnumerable(IServiceCollection, ServiceDescriptor)

Adds a ServiceDescriptor if an existing descriptor with the same ServiceType and an implementation that does not already exist in services...

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>) TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>) TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

Adds the specified ServiceDescriptors if an existing descriptor with the same ServiceType and an implementation that does not already exist in services...

TryAddScoped(IServiceCollection, Type) TryAddScoped(IServiceCollection, Type) TryAddScoped(IServiceCollection, Type)

Adds the specified service as a Scoped service to the collection if the service type hasn't already been registered.

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

Adds the specified service as a Scoped service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddScoped(IServiceCollection, Type, Type) TryAddScoped(IServiceCollection, Type, Type) TryAddScoped(IServiceCollection, Type, Type)

Adds the specified service as a Scoped service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddScoped<TService>(IServiceCollection) TryAddScoped<TService>(IServiceCollection) TryAddScoped<TService>(IServiceCollection)

Adds the specified TService as a Scoped service to the collection if the service type hasn't already been registered.

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

Adds the specified TService as a Scoped service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddScoped<TService,TImplementation>(IServiceCollection) TryAddScoped<TService,TImplementation>(IServiceCollection) TryAddScoped<TService,TImplementation>(IServiceCollection)

Adds the specified TService as a Scoped service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

TryAddSingleton(IServiceCollection, Type) TryAddSingleton(IServiceCollection, Type) TryAddSingleton(IServiceCollection, Type)

Adds the specified service as a Singleton service to the collection if the service type hasn't already been registered.

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

Adds the specified service as a Singleton service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddSingleton(IServiceCollection, Type, Type) TryAddSingleton(IServiceCollection, Type, Type) TryAddSingleton(IServiceCollection, Type, Type)

Adds the specified service as a Singleton service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddSingleton<TService>(IServiceCollection) TryAddSingleton<TService>(IServiceCollection) TryAddSingleton<TService>(IServiceCollection)

Adds the specified TService as a Singleton service to the collection if the service type hasn't already been registered.

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

Adds the specified TService as a Singleton service with an instance specified in instance to the collection if the service type hasn't already been registered.

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

Adds the specified TService as a Singleton service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddSingleton<TService,TImplementation>(IServiceCollection) TryAddSingleton<TService,TImplementation>(IServiceCollection) TryAddSingleton<TService,TImplementation>(IServiceCollection)

Adds the specified TService as a Singleton service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type) TryAddTransient(IServiceCollection, Type) TryAddTransient(IServiceCollection, Type)

Adds the specified service as a Transient service to the collection if the service type hasn't already been registered.

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

Adds the specified service as a Transient service using the factory specified in implementationFactory to the collection if the service type hasn't already been registered.

TryAddTransient(IServiceCollection, Type, Type) TryAddTransient(IServiceCollection, Type, Type) TryAddTransient(IServiceCollection, Type, Type)

Adds the specified service as a Transient service with the implementationType implementation to the collection if the service type hasn't already been registered.

TryAddTransient<TService>(IServiceCollection) TryAddTransient<TService>(IServiceCollection) TryAddTransient<TService>(IServiceCollection)

Adds the specified TService as a Transient service to the collection if the service type hasn't already been registered.

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

Adds the specified TService as a Transient service using the factory specified in implementationFactory to the services if the service type hasn't already been registered.

TryAddTransient<TService,TImplementation>(IServiceCollection) TryAddTransient<TService,TImplementation>(IServiceCollection) TryAddTransient<TService,TImplementation>(IServiceCollection)

Adds the specified TService as a Transient service implementation type specified in TImplementation to the collection if the service type hasn't already been registered.

AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the full name of TClient.

AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpContextAccessor(IServiceCollection) AddHttpContextAccessor(IServiceCollection) AddHttpContextAccessor(IServiceCollection)

Adds a default implementation for the IHttpContextAccessor service.

AddIdentity<TUser,TRole>(IServiceCollection) AddIdentity<TUser,TRole>(IServiceCollection) AddIdentity<TUser,TRole>(IServiceCollection)

Adds the default identity system configuration for the specified User and Role types.

AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>) AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>) AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>)

Adds and configures the identity system for the specified User and Role types.

AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>) AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>) AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>)

Adds and configures the identity system for the specified User and Role types.

AddIdentityCore<TUser>(IServiceCollection) AddIdentityCore<TUser>(IServiceCollection) AddIdentityCore<TUser>(IServiceCollection)

Adds and configures the identity system for the specified User and Role types.

AddIdentityCore<TUser>(IServiceCollection, Action<IdentityOptions>) AddIdentityCore<TUser>(IServiceCollection, Action<IdentityOptions>) AddIdentityCore<TUser>(IServiceCollection, Action<IdentityOptions>)

Adds and configures the identity system for the specified User and Role types.

ConfigureApplicationCookie(IServiceCollection, Action<CookieAuthenticationOptions>) ConfigureApplicationCookie(IServiceCollection, Action<CookieAuthenticationOptions>) ConfigureApplicationCookie(IServiceCollection, Action<CookieAuthenticationOptions>)

Configures the application cookie.

ConfigureExternalCookie(IServiceCollection, Action<CookieAuthenticationOptions>) ConfigureExternalCookie(IServiceCollection, Action<CookieAuthenticationOptions>) ConfigureExternalCookie(IServiceCollection, Action<CookieAuthenticationOptions>)

Configure the external cookie.

AddDefaultIdentity<TUser>(IServiceCollection) AddDefaultIdentity<TUser>(IServiceCollection) AddDefaultIdentity<TUser>(IServiceCollection)
AddDefaultIdentity<TUser>(IServiceCollection, Action<IdentityOptions>) AddDefaultIdentity<TUser>(IServiceCollection, Action<IdentityOptions>) AddDefaultIdentity<TUser>(IServiceCollection, Action<IdentityOptions>)
AddLocalization(IServiceCollection) AddLocalization(IServiceCollection) AddLocalization(IServiceCollection)

Adds services required for application localization.

AddLocalization(IServiceCollection, Action<LocalizationOptions>) AddLocalization(IServiceCollection, Action<LocalizationOptions>) AddLocalization(IServiceCollection, Action<LocalizationOptions>)

Adds services required for application localization.

AddLogging(IServiceCollection) AddLogging(IServiceCollection) AddLogging(IServiceCollection)

Adds logging services to the specified IServiceCollection.

AddLogging(IServiceCollection, Action<ILoggingBuilder>) AddLogging(IServiceCollection, Action<ILoggingBuilder>) AddLogging(IServiceCollection, Action<ILoggingBuilder>)

Adds logging services to the specified IServiceCollection.

AddDistributedMemoryCache(IServiceCollection) AddDistributedMemoryCache(IServiceCollection) AddDistributedMemoryCache(IServiceCollection)

Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>) AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>) AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>)

Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

AddMemoryCache(IServiceCollection) AddMemoryCache(IServiceCollection) AddMemoryCache(IServiceCollection)

Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>) AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>) AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.

AddMvcCore(IServiceCollection) AddMvcCore(IServiceCollection) AddMvcCore(IServiceCollection)

Adds the minimum essential MVC services to the specified IServiceCollection. Additional services including MVC's support for authorization, formatters, and validation must be added separately using the IMvcCoreBuilder returned from this method.

AddMvcCore(IServiceCollection, Action<MvcOptions>) AddMvcCore(IServiceCollection, Action<MvcOptions>) AddMvcCore(IServiceCollection, Action<MvcOptions>)

Adds the minimum essential MVC services to the specified IServiceCollection. Additional services including MVC's support for authorization, formatters, and validation must be added separately using the IMvcCoreBuilder returned from this method.

AddMvc(IServiceCollection) AddMvc(IServiceCollection) AddMvc(IServiceCollection)

Adds MVC services to the specified IServiceCollection.

AddMvc(IServiceCollection, Action<MvcOptions>) AddMvc(IServiceCollection, Action<MvcOptions>) AddMvc(IServiceCollection, Action<MvcOptions>)

Adds MVC services to the specified IServiceCollection.

AddNodeServices(IServiceCollection) AddNodeServices(IServiceCollection) AddNodeServices(IServiceCollection)

Adds NodeServices support to the serviceCollection.

AddNodeServices(IServiceCollection, Action<NodeServicesOptions>) AddNodeServices(IServiceCollection, Action<NodeServicesOptions>) AddNodeServices(IServiceCollection, Action<NodeServicesOptions>)

Adds NodeServices support to the serviceCollection.

Configure<TOptions>(IServiceCollection, IConfiguration) Configure<TOptions>(IServiceCollection, IConfiguration) Configure<TOptions>(IServiceCollection, IConfiguration)

Registers a configuration instance which TOptions will bind against.

Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>) Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>) Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>)

Registers a configuration instance which TOptions will bind against.

Configure<TOptions>(IServiceCollection, String, IConfiguration) Configure<TOptions>(IServiceCollection, String, IConfiguration) Configure<TOptions>(IServiceCollection, String, IConfiguration)

Registers a configuration instance which TOptions will bind against.

Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>) Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>) Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>)

Registers a configuration instance which TOptions will bind against.

AddOptions(IServiceCollection) AddOptions(IServiceCollection) AddOptions(IServiceCollection)

Adds services required for using options.

AddOptions<TOptions>(IServiceCollection) AddOptions<TOptions>(IServiceCollection) AddOptions<TOptions>(IServiceCollection)

Gets an options builder that forwards Configure calls for the same TOptions to the underlying service collection.

AddOptions<TOptions>(IServiceCollection, String) AddOptions<TOptions>(IServiceCollection, String) AddOptions<TOptions>(IServiceCollection, String)

Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

Configure<TOptions>(IServiceCollection, Action<TOptions>) Configure<TOptions>(IServiceCollection, Action<TOptions>) Configure<TOptions>(IServiceCollection, Action<TOptions>)

Registers an action used to configure a particular type of options. Note: These are run before all .

Configure<TOptions>(IServiceCollection, String, Action<TOptions>) Configure<TOptions>(IServiceCollection, String, Action<TOptions>) Configure<TOptions>(IServiceCollection, String, Action<TOptions>)

Registers an action used to configure a particular type of options. Note: These are run before all .

ConfigureAll<TOptions>(IServiceCollection, Action<TOptions>) ConfigureAll<TOptions>(IServiceCollection, Action<TOptions>) ConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

Registers an action used to configure all instances of a particular type of options.

ConfigureOptions(IServiceCollection, Object) ConfigureOptions(IServiceCollection, Object) ConfigureOptions(IServiceCollection, Object)

Registers an object that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions(IServiceCollection, Type) ConfigureOptions(IServiceCollection, Type) ConfigureOptions(IServiceCollection, Type)

Registers a type that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions<TConfigureOptions>(IServiceCollection) ConfigureOptions<TConfigureOptions>(IServiceCollection) ConfigureOptions<TConfigureOptions>(IServiceCollection)

Registers a type that will have all of its I[Post]ConfigureOptions registered.

PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) PostConfigure<TOptions>(IServiceCollection, Action<TOptions>)

Registers an action used to initialize a particular type of options. Note: These are run after all .

PostConfigure<TOptions>(IServiceCollection, String, Action<TOptions>) PostConfigure<TOptions>(IServiceCollection, String, Action<TOptions>) PostConfigure<TOptions>(IServiceCollection, String, Action<TOptions>)

Registers an action used to configure a particular type of options. Note: These are run after all .

PostConfigureAll<TOptions>(IServiceCollection, Action<TOptions>) PostConfigureAll<TOptions>(IServiceCollection, Action<TOptions>) PostConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

Registers an action used to post configure all instances of a particular type of options. Note: These are run after all .

AddAuthorizationPolicyEvaluator(IServiceCollection) AddAuthorizationPolicyEvaluator(IServiceCollection) AddAuthorizationPolicyEvaluator(IServiceCollection)

Adds authorization policy services to the specified IServiceCollection.

AddSpaPrerenderer(IServiceCollection) AddSpaPrerenderer(IServiceCollection) AddSpaPrerenderer(IServiceCollection)

Configures the dependency injection system to supply an implementation of ISpaPrerenderer.

AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>) AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>) AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>)

Adds Redis distributed caching services to the specified IServiceCollection.

AddResponseCaching(IServiceCollection) AddResponseCaching(IServiceCollection) AddResponseCaching(IServiceCollection)

Add response caching services.

AddResponseCaching(IServiceCollection, Action<ResponseCachingOptions>) AddResponseCaching(IServiceCollection, Action<ResponseCachingOptions>) AddResponseCaching(IServiceCollection, Action<ResponseCachingOptions>)

Add response caching services and configure the related options.

AddRouting(IServiceCollection) AddRouting(IServiceCollection) AddRouting(IServiceCollection)

Adds services required for routing requests.

AddRouting(IServiceCollection, Action<RouteOptions>) AddRouting(IServiceCollection, Action<RouteOptions>) AddRouting(IServiceCollection, Action<RouteOptions>)

Adds services required for routing requests.

BuildServiceProvider(IServiceCollection) BuildServiceProvider(IServiceCollection) BuildServiceProvider(IServiceCollection)

Creates a ServiceProvider containing services from the provided IServiceCollection.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions) BuildServiceProvider(IServiceCollection, ServiceProviderOptions) BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

Creates a ServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

BuildServiceProvider(IServiceCollection, Boolean) BuildServiceProvider(IServiceCollection, Boolean) BuildServiceProvider(IServiceCollection, Boolean)

Creates a ServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

AddHostedService<THostedService>(IServiceCollection) AddHostedService<THostedService>(IServiceCollection) AddHostedService<THostedService>(IServiceCollection)

Add an IHostedService registration for the given type.

AddScoped(IServiceCollection, Type) AddScoped(IServiceCollection, Type) AddScoped(IServiceCollection, Type)

Adds a scoped service of the type specified in serviceType to the specified IServiceCollection.

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

Adds a scoped service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddScoped(IServiceCollection, Type, Type) AddScoped(IServiceCollection, Type, Type) AddScoped(IServiceCollection, Type, Type)

Adds a scoped service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddScoped<TService>(IServiceCollection) AddScoped<TService>(IServiceCollection) AddScoped<TService>(IServiceCollection)

Adds a scoped service of the type specified in TService to the specified IServiceCollection.

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

Adds a scoped service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddScoped<TService,TImplementation>(IServiceCollection) AddScoped<TService,TImplementation>(IServiceCollection) AddScoped<TService,TImplementation>(IServiceCollection)

Adds a scoped service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Adds a scoped service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type) AddSingleton(IServiceCollection, Type) AddSingleton(IServiceCollection, Type)

Adds a singleton service of the type specified in serviceType to the specified IServiceCollection.

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

Adds a singleton service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Object) AddSingleton(IServiceCollection, Type, Object) AddSingleton(IServiceCollection, Type, Object)

Adds a singleton service of the type specified in serviceType with an instance specified in implementationInstance to the specified IServiceCollection.

AddSingleton(IServiceCollection, Type, Type) AddSingleton(IServiceCollection, Type, Type) AddSingleton(IServiceCollection, Type, Type)

Adds a singleton service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection) AddSingleton<TService>(IServiceCollection) AddSingleton<TService>(IServiceCollection)

Adds a singleton service of the type specified in TService to the specified IServiceCollection.

AddSingleton<TService>(IServiceCollection, TService) AddSingleton<TService>(IServiceCollection, TService) AddSingleton<TService>(IServiceCollection, TService)

Adds a singleton service of the type specified in TService with an instance specified in implementationInstance to the specified IServiceCollection.

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

Adds a singleton service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection) AddSingleton<TService,TImplementation>(IServiceCollection) AddSingleton<TService,TImplementation>(IServiceCollection)

Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Adds a singleton service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddTransient(IServiceCollection, Type) AddTransient(IServiceCollection, Type) AddTransient(IServiceCollection, Type)

Adds a transient service of the type specified in serviceType to the specified IServiceCollection.

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

Adds a transient service of the type specified in serviceType with a factory specified in implementationFactory to the specified IServiceCollection.

AddTransient(IServiceCollection, Type, Type) AddTransient(IServiceCollection, Type, Type) AddTransient(IServiceCollection, Type, Type)

Adds a transient service of the type specified in serviceType with an implementation of the type specified in implementationType to the specified IServiceCollection.

AddTransient<TService>(IServiceCollection) AddTransient<TService>(IServiceCollection) AddTransient<TService>(IServiceCollection)

Adds a transient service of the type specified in TService to the specified IServiceCollection.

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

Adds a transient service of the type specified in TService with a factory specified in implementationFactory to the specified IServiceCollection.

AddTransient<TService,TImplementation>(IServiceCollection) AddTransient<TService,TImplementation>(IServiceCollection) AddTransient<TService,TImplementation>(IServiceCollection)

Adds a transient service of the type specified in TService with an implementation type specified in TImplementation to the specified IServiceCollection.

AddTransient<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddTransient<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>) AddTransient<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

Adds a transient service of the type specified in TService with an implementation type specified in TImplementation using the factory specified in implementationFactory to the specified IServiceCollection.

AddSession(IServiceCollection) AddSession(IServiceCollection) AddSession(IServiceCollection)

Adds services required for application session state.

AddSession(IServiceCollection, Action<SessionOptions>) AddSession(IServiceCollection, Action<SessionOptions>) AddSession(IServiceCollection, Action<SessionOptions>)

Adds services required for application session state.

AddSignalR(IServiceCollection) AddSignalR(IServiceCollection) AddSignalR(IServiceCollection)

Adds SignalR services to the specified IServiceCollection.

AddSignalR(IServiceCollection, Action<HubOptions>) AddSignalR(IServiceCollection, Action<HubOptions>) AddSignalR(IServiceCollection, Action<HubOptions>)

Adds SignalR services to the specified IServiceCollection.

AddSignalRCore(IServiceCollection) AddSignalRCore(IServiceCollection) AddSignalRCore(IServiceCollection)

Adds the minimum essential SignalR services to the specified IServiceCollection. Additional services must be added separately using the ISignalRServerBuilder returned from this method.

AddSpaStaticFiles(IServiceCollection, Action<SpaStaticFilesOptions>) AddSpaStaticFiles(IServiceCollection, Action<SpaStaticFilesOptions>) AddSpaStaticFiles(IServiceCollection, Action<SpaStaticFilesOptions>)

Registers an ISpaStaticFileProvider service that can provide static files to be served for a Single Page Application (SPA).

AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>) AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>) AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>)

Adds Microsoft SQL Server distributed caching services to the specified IServiceCollection.

Applies to