Class CollectionBuilderBase<TBuilder, TCollection, TItem>
Provides a base class for collection builders.
Inheritance
Namespace: Umbraco.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 SourceCollectionLifetime
Gets the collection lifetime.
Declaration
protected virtual Lifetime CollectionLifetime { get; }
Property Value
Type | Description |
---|---|
Lifetime |
Methods
View SourceConfigure(Action<List<Type>>)
Configures the internal list of types.
Declaration
protected void Configure(Action<List<Type>> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Collections.Generic.List<System.Type>> | action | The action to execute. |
Remarks
Throws if the types have already been registered.
CreateCollection(IFactory)
Creates a collection.
Declaration
public virtual TCollection CreateCollection(IFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IFactory | factory |
Returns
Type | Description |
---|---|
TCollection | A collection. |
Remarks
Creates a new collection each time it is invoked.
CreateItem(IFactory, Type)
Creates a collection item.
Declaration
protected virtual TItem CreateItem(IFactory factory, Type itemType)
Parameters
Type | Name | Description |
---|---|---|
IFactory | factory | |
System.Type | itemType |
Returns
Type | Description |
---|---|
TItem |
CreateItems(IFactory)
Creates the collection items.
Declaration
protected virtual IEnumerable<TItem> CreateItems(IFactory factory)
Parameters
Type | Name | Description |
---|---|---|
IFactory | factory |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TItem> | The collection items. |
EnsureType(Type, String)
Declaration
protected Type EnsureType(Type type, string action)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | |
System.String | action |
Returns
Type | Description |
---|---|
System.Type |
GetRegisteringTypes(IEnumerable<Type>)
Gets the types.
Declaration
protected virtual IEnumerable<Type> GetRegisteringTypes(IEnumerable<Type> types)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Type> | types | The internal list of types. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> | The list of types to register. |
Remarks
Used by implementations to add types to the internal list, sort the list, etc.
GetTypes()
Gets the internal list of types as an IEnumerable (immutable).
Declaration
public IEnumerable<Type> GetTypes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |
Has(Type)
Gets a value indicating whether the collection contains a type.
Declaration
public virtual bool Has(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.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.
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.
RegisterWith(IRegister)
Registers the builder so it can build the collection, by registering the collection and the types.
Declaration
public virtual void RegisterWith(IRegister register)
Parameters
Type | Name | Description |
---|---|---|
IRegister | register |