Table of Contents

Class ServiceSwitcherSingleton<T>

Namespace
ToSic.Sys.DI
Assembly
ToSic.Sys.Core.dll

Similar to the ServiceSwitcher<T> but special.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public class ServiceSwitcherSingleton<T> : ServiceBase, IHasLog where T : ISwitchableService

Type Parameters

T
Inheritance
object
ServiceSwitcherSingleton<T>
Implements
Inherited Members

Remarks

It will behave as singleton, but will resolve Transient! this is important. Reason is that this way we don't keep a list of all possible services active in memory, just the one that's been selected.

Constructors

ServiceSwitcherSingleton(ILogStore, LazySvc<ServiceSwitcher<T>>, object[]?)

Similar to the ServiceSwitcher<T> but special.

public ServiceSwitcherSingleton(ILogStore logStore, LazySvc<ServiceSwitcher<T>> serviceSwitcher, object[]? connect = null)

Parameters

logStore ILogStore
serviceSwitcher LazySvc<ServiceSwitcher<T>>
connect object[]

Remarks

It will behave as singleton, but will resolve Transient! this is important. Reason is that this way we don't keep a list of all possible services active in memory, just the one that's been selected.

Properties

IsValueCreated

public bool IsValueCreated { get; }

Property Value

bool

Value

public T Value { get; }

Property Value

T

Methods

ByNameId(string)

public T? ByNameId(string nameId)

Parameters

nameId string

Returns

T

Reset()

protected void Reset()