Show / Hide Table of Contents

    Interface IBinding

    IBinding allows mapping of a contract type ContractType to an IProvider that provides the dependency for the type. It contains extra information that enables the IResolver to locate the correct IBinding and IProvider. IBinding also contains convenient methods that allow us to chain method calls.

        container.Bind<IEventService>().To<EventService>().AsSingle().Conclude();

    Namespace: IdleKit.Core
    Assembly: cs.temp.dll.dll
    Syntax
    public interface IBinding

    Properties

    ContractType

    The contract type of this IBinding.

    Declaration
    Type ContractType { get; }
    Property Value
    Type Description
    Type

    Id

    An optional Id field so we can have different bindings with the same ContractType.

    Declaration
    object Id { get; }
    Property Value
    Type Description
    Object

    Lifestyle

    The scope of dependency provided by the IProvider. AsTransient() is the default Lifestyle.

    Declaration
    Lifestyle Lifestyle { get; }
    Property Value
    Type Description
    Lifestyle

    Provider

    The IProvider of the dependency for this contract.

    Declaration
    IProvider Provider { get; }
    Property Value
    Type Description
    IProvider

    Methods

    AsCached()

    Marks the scope of the instance provided by the IProvider as Cached

    Declaration
    IBinding AsCached()
    Returns
    Type Description
    IBinding

    AsSingleton()

    Marks the scope of the instance provided by the IProvider as Singleton

    Declaration
    IBinding AsSingleton()
    Returns
    Type Description
    IBinding

    AsTransient()

    Marks the scope of the instance provided by the IProvider as Transient

    Declaration
    IBinding AsTransient()
    Returns
    Type Description
    IBinding

    Conclude()

    Conclude the binding command and register the IBinding in the IResolver

    Declaration
    IBinding Conclude()
    Returns
    Type Description
    IBinding

    FromMethod<TConcrete>(Func<TConcrete>)

    Maps the IBinding of ContractType to a method that returns the TConcrete.

    Declaration
    IBinding FromMethod<TConcrete>(Func<TConcrete> method)
        where TConcrete : class
    Parameters
    Type Name Description
    Func<TConcrete> method
    Returns
    Type Description
    IBinding
    Type Parameters
    Name Description
    TConcrete

    FromProvider(IProvider)

    Maps the IBinding of ContractType to an IProvider that is able to provide an instance of a ContractType.

    Declaration
    IBinding FromProvider(IProvider newProvider)
    Parameters
    Type Name Description
    IProvider newProvider
    Returns
    Type Description
    IBinding

    To<TConcrete>()

    Maps the IBinding of ContractType to the TConcrete.

    Declaration
    IBinding To<TConcrete>()
        where TConcrete : class
    Returns
    Type Description
    IBinding
    Type Parameters
    Name Description
    TConcrete

    ToId(Object)

    Associates the IBinding with an id so we can have multiple binding of the same ContractType

    Declaration
    IBinding ToId(object id)
    Parameters
    Type Name Description
    Object id
    Returns
    Type Description
    IBinding

    ToInstance(Object)

    Maps the IBinding of ContractType to an instance.

    Declaration
    IBinding ToInstance(object instance)
    Parameters
    Type Name Description
    Object instance
    Returns
    Type Description
    IBinding
    Back to top Copyright © 2020 East Side Games Inc.