Class StartupSysCore
Startup registration for all of ToSic.Sys.Core. This is the innermost foundation of services.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static class StartupSysCore
- Inheritance
-
objectStartupSysCore
Methods
AddSysCore(IServiceCollection, bool)
Add all SysCore services
public static IServiceCollection AddSysCore(this IServiceCollection services, bool useMel = false)
Parameters
servicesIServiceCollectionThe service collection to which the wrapper services will be added. Cannot be null.
useMelboolSelects 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
servicesIServiceCollection
Returns
AddSysCoreDi(IServiceCollection)
Add all core Dependency Injection parts, such as Lazy, Generator, etc.
public static IServiceCollection AddSysCoreDi(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
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
servicesIServiceCollection
Returns
Remarks
Adds
- Ctx<TService> - context specifically injected objects
- 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
servicesIServiceCollection
Returns
Remarks
Call once anywhere in your startup configuration—order does not matter. Adds:
- ToSic.Sys.DI.KeyedServiceRegistry - the registry itself
- IAllKeyedServices<TKey, TService> - the resolver/lookup
AddSysCoreDiLazyAndGenerators(IServiceCollection)
Add Dependency Injection foundation - needed for almost everything.
public static IServiceCollection AddSysCoreDiLazyAndGenerators(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
Remarks
Adds
- Lazy<T> - lazy objects
- LazySvc<TService> - lazy services, preferred method for services as it connects logs
- Generator<TService> - classic generator
- Generator<TService, TOptions> - generator with options
AddSysCoreDiServiceProvider(IServiceCollection)
Add Dependency Injection foundation - needed for almost everything.
public static IServiceCollection AddSysCoreDiServiceProvider(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
Remarks
Adds
- ISysServiceProvider - the context aware service provider
AddSysCoreDiServiceSwitchers(IServiceCollection)
Add Service Switchers OBSOLETE - v22.02
public static IServiceCollection AddSysCoreDiServiceSwitchers(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
AddSysCoreInsightsLogger(ILoggingBuilder)
public static ILoggingBuilder AddSysCoreInsightsLogger(this ILoggingBuilder logging)
Parameters
loggingILoggingBuilder
Returns
AddSysCoreLegacyLogging(IServiceCollection)
public static IServiceCollection AddSysCoreLegacyLogging(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
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
servicesIServiceCollectionuseMelbool
Returns
AddSysCoreMelInsightsLogging(IServiceCollection)
public static IServiceCollection AddSysCoreMelInsightsLogging(this IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
AddSysCoreMelLogging(IServiceCollection)
public static IServiceCollection AddSysCoreMelLogging(this IServiceCollection services)
Parameters
servicesIServiceCollection