Table of Contents

Class StartupSysCore

Namespace
ToSic.Sys.Run.Startup
Assembly
ToSic.Sys.Core.dll

Startup registration for all of ToSic.Sys.Core. This is the innermost foundation of services.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static class StartupSysCore
Inheritance
object
StartupSysCore

Methods

AddSysCore(IServiceCollection, bool)

Add all SysCore services

public static IServiceCollection AddSysCore(this IServiceCollection services, bool useMel = false)

Parameters

services IServiceCollection

The service collection to which the wrapper services will be added. Cannot be null.

useMel bool

Selects MEL logging with Insights instead of the default Legacy stack.

Returns

IServiceCollection

The same IServiceCollection instance, enabling method chaining.

Remarks

Call this method during application startup to ensure wrapper dependencies are available for injection.

AddSysCoreBoot(IServiceCollection)

Add core boot and configuration services

public static IServiceCollection AddSysCoreBoot(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

AddSysCoreDi(IServiceCollection)

Add all core Dependency Injection parts, such as Lazy, Generator, etc.

public static IServiceCollection AddSysCoreDi(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

For testing or special integrations, you may want to explicitly add only the parts you need, using the other methods in this class.

But since everything uses TryAdd, it's also safe to just add them before calling this.

AddSysCoreDiContext(IServiceCollection)

Add Dependency Injection context services - used mostly in code which is aware of the context.

public static IServiceCollection AddSysCoreDiContext(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

Adds

  1. Ctx<TService> - context specifically injected objects
  2. ToSic.Sys.DI.CtxValue<TService> - context specifically injected values (internal)

AddSysCoreDiKeyRegistry(IServiceCollection)

Register the system to pick up all keys of all registered, named services.

public static IServiceCollection AddSysCoreDiKeyRegistry(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

Call once anywhere in your startup configuration—order does not matter. Adds:

  1. ToSic.Sys.DI.KeyedServiceRegistry - the registry itself
  2. IAllKeyedServices<TKey, TService> - the resolver/lookup

AddSysCoreDiLazyAndGenerators(IServiceCollection)

Add Dependency Injection foundation - needed for almost everything.

public static IServiceCollection AddSysCoreDiLazyAndGenerators(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

Adds

  1. Lazy<T> - lazy objects
  2. LazySvc<TService> - lazy services, preferred method for services as it connects logs
  3. Generator<TService> - classic generator
  4. Generator<TService, TOptions> - generator with options

AddSysCoreDiServiceProvider(IServiceCollection)

Add Dependency Injection foundation - needed for almost everything.

public static IServiceCollection AddSysCoreDiServiceProvider(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Remarks

Adds

  1. ISysServiceProvider - the context aware service provider

AddSysCoreDiServiceSwitchers(IServiceCollection)

Add Service Switchers OBSOLETE - v22.02

public static IServiceCollection AddSysCoreDiServiceSwitchers(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

AddSysCoreInsightsLogger(ILoggingBuilder)

public static ILoggingBuilder AddSysCoreInsightsLogger(this ILoggingBuilder logging)

Parameters

logging ILoggingBuilder

Returns

ILoggingBuilder

AddSysCoreLegacyLogging(IServiceCollection)

public static IServiceCollection AddSysCoreLegacyLogging(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

AddSysCoreLogging(IServiceCollection, bool)

Registers one complete logging stack. Call once at startup; changing stacks requires an application restart. Factory, store and reader use the same selection so Insights cannot resolve a mixed stack.

public static IServiceCollection AddSysCoreLogging(this IServiceCollection services, bool useMel = false)

Parameters

services IServiceCollection
useMel bool

Returns

IServiceCollection

AddSysCoreMelInsightsLogging(IServiceCollection)

public static IServiceCollection AddSysCoreMelInsightsLogging(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

AddSysCoreMelLogging(IServiceCollection)

public static IServiceCollection AddSysCoreMelLogging(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection