ServiceCollectionDescriptorExtensions Class

Namespace
Microsoft.Extensions.DependencyInjection.Extensions
Assemblies
  • Microsoft.Extensions.DependencyInjection.Abstractions

Syntax

public class ServiceCollectionDescriptorExtensions
class Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions

Methods

Add(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor)

Adds the specified <em>descriptor</em> to the <em>collection</em>.

Arguments:
Return type:

Microsoft.Extensions.DependencyInjection.IServiceCollection

Returns:

A reference to the current instance of Microsoft.Extensions.DependencyInjection.IServiceCollection.

public static IServiceCollection Add(this IServiceCollection collection, ServiceDescriptor descriptor)
Add(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>)

Adds a sequence of Microsoft.Extensions.DependencyInjection.ServiceDescriptor to the <em>collection</em>.

Arguments:
Return type:

Microsoft.Extensions.DependencyInjection.IServiceCollection

Returns:

A reference to the current instance of Microsoft.Extensions.DependencyInjection.IServiceCollection.

public static IServiceCollection Add(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
Replace(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor)

Removes the first service in Microsoft.Extensions.DependencyInjection.IServiceCollection with the same service type as <em>descriptor</em> and adds <paramef name=”descriptor”></paramef> to the collection.

Arguments:
Return type:

Microsoft.Extensions.DependencyInjection.IServiceCollection

public static IServiceCollection Replace(this IServiceCollection collection, ServiceDescriptor descriptor)
TryAdd(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor)

Adds the specified <em>descriptor</em> to the <em>collection</em> if the service type hasn’t been already registered.

Arguments:
public static void TryAdd(this IServiceCollection collection, ServiceDescriptor descriptor)
TryAdd(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>)

Adds the specified <em>descriptors</em> to the <em>collection</em> if the service type hasn’t been already registered.

Arguments:
public static void TryAdd(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
TryAddEnumerable(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.ServiceDescriptor)

Adds a Microsoft.Extensions.DependencyInjection.ServiceDescriptor if an existing descriptor with the same Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceType and an implementation that does not already exist in <em>services..</em>.

Arguments:
public static void TryAddEnumerable(this IServiceCollection services, ServiceDescriptor descriptor)
TryAddEnumerable(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>)

Adds the specified Microsoft.Extensions.DependencyInjection.ServiceDescriptors if an existing descriptor with the same Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceType and an implementation that does not already exist in <em>services..</em>.

Arguments:
public static void TryAddEnumerable(this IServiceCollection services, IEnumerable<ServiceDescriptor> descriptors)
TryAddScoped(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type)
public static void TryAddScoped(this IServiceCollection collection, Type service)
TryAddScoped(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Func<System.IServiceProvider, System.Object>)
public static void TryAddScoped(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
TryAddScoped(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Type)
public static void TryAddScoped(this IServiceCollection collection, Type service, Type implementationType)
TryAddScoped<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddScoped<TService>(this IServiceCollection collection)where TService : class
TryAddScoped<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Func<System.IServiceProvider, TService>)
public static void TryAddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)where TService : class
TryAddScoped<TService, TImplementation>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddScoped<TService, TImplementation>(this IServiceCollection collection)where TService : class where TImplementation : class, TService
TryAddSingleton(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type)
public static void TryAddSingleton(this IServiceCollection collection, Type service)
TryAddSingleton(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Func<System.IServiceProvider, System.Object>)
public static void TryAddSingleton(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
TryAddSingleton(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Type)
public static void TryAddSingleton(this IServiceCollection collection, Type service, Type implementationType)
TryAddSingleton<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddSingleton<TService>(this IServiceCollection collection)where TService : class
TryAddSingleton<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Func<System.IServiceProvider, TService>)
public static void TryAddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)where TService : class
TryAddSingleton<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection, TService)
public static void TryAddSingleton<TService>(this IServiceCollection collection, TService instance)where TService : class
TryAddSingleton<TService, TImplementation>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddSingleton<TService, TImplementation>(this IServiceCollection collection)where TService : class where TImplementation : class, TService
TryAddTransient(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type)
public static void TryAddTransient(this IServiceCollection collection, Type service)
TryAddTransient(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Func<System.IServiceProvider, System.Object>)
public static void TryAddTransient(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
TryAddTransient(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Type, System.Type)
public static void TryAddTransient(this IServiceCollection collection, Type service, Type implementationType)
TryAddTransient<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddTransient<TService>(this IServiceCollection collection)where TService : class
TryAddTransient<TService>(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Func<System.IServiceProvider, TService>)
public static void TryAddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory)where TService : class
TryAddTransient<TService, TImplementation>(Microsoft.Extensions.DependencyInjection.IServiceCollection)
public static void TryAddTransient<TService, TImplementation>(this IServiceCollection collection)where TService : class where TImplementation : class, TService