Table of Contents

Class Generator<TService>

Namespace
ToSic.Lib.DI
Assembly
ToSic.Lib.Core.dll

Lazy generator to create multiple new services/objects of a specific type.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public class Generator<TService> : IHasLog

Type Parameters

TService
Inheritance
Generator<TService>
Implements

Constructors

Generator(IServiceProvider)

Constructor should only be used in DI context and never be called directly.

public Generator(IServiceProvider sp)

Parameters

sp IServiceProvider

Properties

Log

The parent log, which is attached to newly generated objects if they support logging.

public ILog Log { get; }

Property Value

ILog

Methods

New()

Factory method to generate a new service

public TService New()

Returns

TService

SetInit(Action<TService>)

Set the init-command as needed

public Generator<TService> SetInit(Action<TService> newInitCall)

Parameters

newInitCall Action<TService>

Returns

Generator<TService>