Search Results for

    Show / Hide Table of Contents
    View Source

    Class ServiceProviderExtensions

    Provides extension methods to the class.

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

    Methods

    View Source

    CreateDefaultPublishedModelFactory(IServiceProvider)

    Declaration
    public static PublishedModelFactory CreateDefaultPublishedModelFactory(this IServiceProvider factory)
    Parameters
    Type Name Description
    IServiceProvider factory
    Returns
    Type Description
    PublishedModelFactory
    View Source

    CreateInstance(IServiceProvider, Type, Object[])

    Creates an instance of a service, with arguments.

    Declaration
    public static object CreateInstance(this IServiceProvider serviceProvider, Type type, params object[] args)
    Parameters
    Type Name Description
    IServiceProvider serviceProvider

    The

    Type type

    The type of the instance.

    System.Object[] args

    Named arguments.

    Returns
    Type Description
    System.Object

    An instance of the specified type.

    Remarks

    The instance type does not need to be registered into the factory.

    The arguments are used as dependencies by the factory. Other dependencies are retrieved from the factory.

    View Source

    CreateInstance<T>(IServiceProvider, Object[])

    Creates an instance with arguments.

    Declaration
    public static T CreateInstance<T>(this IServiceProvider serviceProvider, params object[] args)
        where T : class
    Parameters
    Type Name Description
    IServiceProvider serviceProvider

    The factory.

    System.Object[] args

    Arguments.

    Returns
    Type Description
    T

    An instance of the specified type.

    Type Parameters
    Name Description
    T

    The type of the instance.

    Remarks

    Throws an exception if the factory failed to get an instance of the specified type.

    The arguments are used as dependencies by the factory.

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • CreateDefaultPublishedModelFactory(IServiceProvider)
      • CreateInstance(IServiceProvider, Type, Object[])
      • CreateInstance<T>(IServiceProvider, Object[])
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX