Search Results for

    Show / Hide Table of Contents

    Class ServiceDescriptor

    Describes a service with its service type, implementation, and lifetime.

    Inheritance
    object
    ServiceDescriptor
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: nanoFramework.DependencyInjection
    Assembly: nanoFramework.DependencyInjection.dll
    Syntax
    public class ServiceDescriptor

    Constructors

    ServiceDescriptor(Type, object)

    Initializes a new instance of ServiceDescriptor with the specified instance as a Singleton.

    Declaration
    public ServiceDescriptor(Type serviceType, object instance)
    Parameters
    Type Name Description
    Type serviceType

    The Type of the service.

    object instance

    The instance implementing the service.

    Exceptions
    Type Condition
    ArgumentNullException

    serviceType or instance can't be null

    ServiceDescriptor(Type, Type, ServiceLifetime)

    Initializes a new instance of ServiceDescriptor with the specified implementationType.

    Declaration
    public ServiceDescriptor(Type serviceType, Type implementationType, ServiceLifetime lifetime)
    Parameters
    Type Name Description
    Type serviceType

    The Type of the service.

    Type implementationType

    The Type implementing the service.

    ServiceLifetime lifetime

    The ServiceLifetime of the service.

    Exceptions
    Type Condition
    ArgumentNullException

    serviceType or implementationType can't be null

    ArgumentException

    Implementation type cannot be an abstract or interface class.

    Properties

    ImplementationInstance

    The instance of the implementation.

    Declaration
    public object ImplementationInstance { get; set; }
    Property Value
    Type Description
    object

    ImplementationType

    The Type implementing the service.

    Declaration
    public Type ImplementationType { get; }
    Property Value
    Type Description
    Type

    Lifetime

    The ServiceLifetime of the service.

    Declaration
    public ServiceLifetime Lifetime { get; }
    Property Value
    Type Description
    ServiceLifetime

    ServiceType

    The Type of the service.

    Declaration
    public Type ServiceType { get; }
    Property Value
    Type Description
    Type

    Methods

    Describe(Type, Type, ServiceLifetime)

    Creates an instance of ServiceDescriptor with the specified serviceType, implementationType, and lifetime.

    Declaration
    public static ServiceDescriptor Describe(Type serviceType, Type implementationType, ServiceLifetime lifetime)
    Parameters
    Type Name Description
    Type serviceType

    The type of the service.

    Type implementationType

    The type of the implementation.

    ServiceLifetime lifetime

    The lifetime of the service.

    Returns
    Type Description
    ServiceDescriptor

    A new instance of ServiceDescriptor.

    GetImplementationType()

    Returns the Type implementing the instance.

    Declaration
    public Type GetImplementationType()
    Returns
    Type Description
    Type

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    In this article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX