Search Results for

    Show / Hide Table of Contents

    Method AddSubtypesOf

    | Improve this Doc View Source

    AddSubtypesOf<TSupertype>(IServiceCollection, ServiceLifetime)

    Adds the subtypes that implement the contract specified by TSupertype to the service collection, using the assemblies loaded by PluginLoader.

    Declaration
    public static IServiceCollection AddSubtypesOf<TSupertype>(this IServiceCollection services, ServiceLifetime serviceLifetime)
        where TSupertype : class
    Parameters
    Type Name Description
    IServiceCollection services

    The IServiceCollection to add the service to.

    ServiceLifetime serviceLifetime

    Specifies the lifetime of the services to be added to the service collection.

    Returns
    Type Description
    IServiceCollection

    A reference to this instance after the operation has completed.

    Type Parameters
    Name Description
    TSupertype

    The type of contract (base type) shared between the host application and the plugins.

    Remarks

    This method uses the PluginAttribute type to add the implementations of the contract to the service collection, so plugins must use it.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright ©2023 CPlugin.Net