Search Results for

    Show / Hide Table of Contents
    View Source

    Class ServiceCollectionExtensions

    Inheritance
    System.Object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class ServiceCollectionExtensions

    Methods

    View Source

    AddMultipleUnique<TService1, TService2, TImplementing>(IServiceCollection)

    Adds services of types TService1 & TService2 with a shared implementation type of TImplementing to the specified .

    Declaration
    public static void AddMultipleUnique<TService1, TService2, TImplementing>(this IServiceCollection services)
        where TService1 : class where TService2 : class where TImplementing : class, TService1, TService2
    Parameters
    Type Name Description
    IServiceCollection services
    Type Parameters
    Name Description
    TService1
    TService2
    TImplementing
    Remarks

    Removes all previous registrations for the types TService1 & TService2.

    View Source

    AddMultipleUnique<TService1, TService2, TImplementing>(IServiceCollection, ServiceLifetime)

    Adds services of types TService1 & TService2 with a shared implementation type of TImplementing to the specified .

    Declaration
    public static void AddMultipleUnique<TService1, TService2, TImplementing>(this IServiceCollection services, ServiceLifetime lifetime)
        where TService1 : class where TService2 : class where TImplementing : class, TService1, TService2
    Parameters
    Type Name Description
    IServiceCollection services
    ServiceLifetime lifetime
    Type Parameters
    Name Description
    TService1
    TService2
    TImplementing
    Remarks

    Removes all previous registrations for the types TService1 & TService2.

    View Source

    AddUnique(IServiceCollection, Type, Object)

    Adds a singleton service of the type specified by serviceType to the specified .

    Declaration
    public static void AddUnique(this IServiceCollection services, Type serviceType, object instance)
    Parameters
    Type Name Description
    IServiceCollection services
    Type serviceType
    System.Object instance
    Remarks

    Removes all previous registrations for the type specified by serviceType.

    View Source

    AddUnique<TService>(IServiceCollection, TService)

    Adds a singleton service of type TService to the specified .

    Declaration
    public static void AddUnique<TService>(this IServiceCollection services, TService instance)
        where TService : class
    Parameters
    Type Name Description
    IServiceCollection services
    TService instance
    Type Parameters
    Name Description
    TService
    Remarks

    Removes all previous registrations for the type type TService.

    View Source

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

    Adds a service of type TService with an implementation factory method to the specified .

    Declaration
    public static void AddUnique<TService>(this IServiceCollection services, Func<IServiceProvider, TService> factory)
        where TService : class
    Parameters
    Type Name Description
    IServiceCollection services
    Func<IServiceProvider, TService> factory
    Type Parameters
    Name Description
    TService
    Remarks

    Removes all previous registrations for the type TService.

    View Source

    AddUnique<TService>(IServiceCollection, Func<IServiceProvider, TService>, ServiceLifetime)

    Adds a service of type TService with an implementation factory method to the specified .

    Declaration
    public static void AddUnique<TService>(this IServiceCollection services, Func<IServiceProvider, TService> factory, ServiceLifetime lifetime)
        where TService : class
    Parameters
    Type Name Description
    IServiceCollection services
    Func<IServiceProvider, TService> factory
    ServiceLifetime lifetime
    Type Parameters
    Name Description
    TService
    Remarks

    Removes all previous registrations for the type TService.

    View Source

    AddUnique<TService, TImplementing>(IServiceCollection)

    Adds a service of type TService with an implementation type of TImplementing to the specified .

    Declaration
    public static void AddUnique<TService, TImplementing>(this IServiceCollection services)
        where TService : class where TImplementing : class, TService
    Parameters
    Type Name Description
    IServiceCollection services
    Type Parameters
    Name Description
    TService
    TImplementing
    Remarks

    Removes all previous registrations for the type TService.

    View Source

    AddUnique<TService, TImplementing>(IServiceCollection, ServiceLifetime)

    Adds a service of type TService with an implementation type of TImplementing to the specified .

    Declaration
    public static void AddUnique<TService, TImplementing>(this IServiceCollection services, ServiceLifetime lifetime)
        where TService : class where TImplementing : class, TService
    Parameters
    Type Name Description
    IServiceCollection services
    ServiceLifetime lifetime
    Type Parameters
    Name Description
    TService
    TImplementing
    Remarks

    Removes all previous registrations for the type TService.

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • AddMultipleUnique<TService1, TService2, TImplementing>(IServiceCollection)
      • AddMultipleUnique<TService1, TService2, TImplementing>(IServiceCollection, ServiceLifetime)
      • AddUnique(IServiceCollection, Type, Object)
      • AddUnique<TService>(IServiceCollection, TService)
      • AddUnique<TService>(IServiceCollection, Func<IServiceProvider, TService>)
      • AddUnique<TService>(IServiceCollection, Func<IServiceProvider, TService>, ServiceLifetime)
      • AddUnique<TService, TImplementing>(IServiceCollection)
      • AddUnique<TService, TImplementing>(IServiceCollection, ServiceLifetime)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX