docs.unity3d.com
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.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.MVVM
    Assembly: Unity.AppUI.MVVM.dll
    Syntax
    public class ServiceDescriptor

    Constructors

    ServiceDescriptor(Type, Type, ServiceLifetime)

    Creates a new instance of ServiceDescriptor.

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

    The service type.

    Type implementationType

    The implementation type.

    ServiceLifetime lifetime

    The lifetime of the service.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if serviceType or implementationType is null.

    Properties

    implementationType

    Gets the implementation type of the service.

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

    lifetime

    Gets the lifetime of the service.

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

    serviceType

    Gets the service type.

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

    Methods

    Scoped(Type, Type)

    Creates a new instance of ServiceDescriptor as a scoped.

    Declaration
    public static ServiceDescriptor Scoped(Type serviceType, Type implementationType)
    Parameters
    Type Name Description
    Type serviceType

    The service type.

    Type implementationType

    The implementation type.

    Returns
    Type Description
    ServiceDescriptor

    The service descriptor

    Singleton(Type, Type)

    Creates a new instance of ServiceDescriptor as a singleton.

    Declaration
    public static ServiceDescriptor Singleton(Type serviceType, Type implementationType)
    Parameters
    Type Name Description
    Type serviceType

    The service type.

    Type implementationType

    The implementation type.

    Returns
    Type Description
    ServiceDescriptor

    The service descriptor.

    Transient(Type, Type)

    Creates a new instance of ServiceDescriptor as a transient.

    Declaration
    public static ServiceDescriptor Transient(Type type, Type implementationType)
    Parameters
    Type Name Description
    Type type

    The service type.

    Type implementationType

    The implementation type.

    Returns
    Type Description
    ServiceDescriptor

    The service descriptor.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)