Search Results for

    Show / Hide Table of Contents
    View Source

    Class CollectionBuilderBase<TBuilder, TCollection, TItem>

    Provides a base class for collection builders.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Composing
    Assembly: Umbraco.Core.dll
    Syntax
    public abstract class CollectionBuilderBase<TBuilder, TCollection, TItem> : ICollectionBuilder<TCollection, TItem>, ICollectionBuilder where TBuilder : CollectionBuilderBase<TBuilder, TCollection, TItem> where TCollection : class, IBuilderCollection<TItem>
    Type Parameters
    Name Description
    TBuilder

    The type of the builder.

    TCollection

    The type of the collection.

    TItem

    The type of the items.

    Properties

    View Source

    CollectionLifetime

    Gets the collection lifetime.

    Declaration
    protected virtual ServiceLifetime CollectionLifetime { get; }
    Property Value
    Type Description
    ServiceLifetime

    Methods

    View Source

    Configure(Action<List<Type>>)

    Configures the internal list of types.

    Declaration
    protected void Configure(Action<List<Type>> action)
    Parameters
    Type Name Description
    Action<List<Type>> action

    The action to execute.

    Remarks

    Throws if the types have already been registered.

    View Source

    CreateCollection(IServiceProvider)

    Creates a collection.

    Declaration
    public virtual TCollection CreateCollection(IServiceProvider factory)
    Parameters
    Type Name Description
    IServiceProvider factory
    Returns
    Type Description
    TCollection

    A collection.

    Remarks

    Creates a new collection each time it is invoked.

    View Source

    CreateItem(IServiceProvider, Type)

    Creates a collection item.

    Declaration
    protected virtual TItem CreateItem(IServiceProvider factory, Type itemType)
    Parameters
    Type Name Description
    IServiceProvider factory
    Type itemType
    Returns
    Type Description
    TItem
    View Source

    CreateItems(IServiceProvider)

    Creates the collection items.

    Declaration
    protected virtual IEnumerable<TItem> CreateItems(IServiceProvider factory)
    Parameters
    Type Name Description
    IServiceProvider factory
    Returns
    Type Description
    IEnumerable<TItem>

    The collection items.

    View Source

    EnsureType(Type, String)

    Declaration
    protected Type EnsureType(Type type, string action)
    Parameters
    Type Name Description
    Type type
    System.String action
    Returns
    Type Description
    Type
    View Source

    GetRegisteringTypes(IEnumerable<Type>)

    Gets the types.

    Declaration
    protected virtual IEnumerable<Type> GetRegisteringTypes(IEnumerable<Type> types)
    Parameters
    Type Name Description
    IEnumerable<Type> types

    The internal list of types.

    Returns
    Type Description
    IEnumerable<Type>

    The list of types to register.

    Remarks

    Used by implementations to add types to the internal list, sort the list, etc.

    View Source

    GetTypes()

    Gets the internal list of types as an IEnumerable (immutable).

    Declaration
    public IEnumerable<Type> GetTypes()
    Returns
    Type Description
    IEnumerable<Type>
    View Source

    Has(Type)

    Gets a value indicating whether the collection contains a type.

    Declaration
    public virtual bool Has(Type type)
    Parameters
    Type Name Description
    Type type

    The type to look for.

    Returns
    Type Description
    System.Boolean

    A value indicating whether the collection contains the type.

    Remarks

    Some builder implementations may use this to expose a public Has{T}() method, when it makes sense. Probably does not make sense for lazy builders, for example.

    View Source

    Has<T>()

    Gets a value indicating whether the collection contains a type.

    Declaration
    public virtual bool Has<T>()
        where T : TItem
    Returns
    Type Description
    System.Boolean

    A value indicating whether the collection contains the type.

    Type Parameters
    Name Description
    T

    The type to look for.

    Remarks

    Some builder implementations may use this to expose a public Has{T}() method, when it makes sense. Probably does not make sense for lazy builders, for example.

    View Source

    RegisterWith(IServiceCollection)

    Registers the builder so it can build the collection, by registering the collection and the types.

    Declaration
    public virtual void RegisterWith(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services
    • Improve this Doc
    • View Source
    In This Article
    • Properties
      • CollectionLifetime
    • Methods
      • Configure(Action<List<Type>>)
      • CreateCollection(IServiceProvider)
      • CreateItem(IServiceProvider, Type)
      • CreateItems(IServiceProvider)
      • EnsureType(Type, String)
      • GetRegisteringTypes(IEnumerable<Type>)
      • GetTypes()
      • Has(Type)
      • Has<T>()
      • RegisterWith(IServiceCollection)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX