Class ApplicationStartup
- Namespace
- Tlabs
- Assembly
- Tlabs.Core.dll
Class to facillitate the creation of the application's start-up configuration expressed as a pre-configured IHostBuilder.
public sealed class ApplicationStartup
- Inheritance
-
ApplicationStartup
- Inherited Members
- Extension Methods
Remarks
The ambition of this ApplicationStartup class is to reducee hard-coded pre-configuration to an absolute minimum with favor of
leveraging the IConfigurator<T> base ApplyConfigurator(...)
pattern.
Constructors
ApplicationStartup()
public ApplicationStartup()
Fields
APP_ENV_VAR
Environment variable to control loading of an additional settings file with the naming pattern:
appsettings.{%APP_ENV_VAR%}.json
.
public const string APP_ENV_VAR = "ASPNETCORE_ENVIRONMENT"
Field Value
Examples
appsettings.Development.json appsettings.Azure.json
APP_SVC_SECTION
Application services config section.
public const string APP_SVC_SECTION = "applicationServices"
Field Value
DFLT_HOST_SECTION
Default section of the configuratiion to be used for the start-up hosting environment setup.
public const string DFLT_HOST_SECTION = "appHosting"
Field Value
Methods
CreateAppHostBuilder(string, string[]?, Action<IHostBuilder, IConfiguration>?)
Create a IHostBuilder from hostSection
and command line args
.
public static IHostBuilder CreateAppHostBuilder(string hostSection, string[]? args = null, Action<IHostBuilder, IConfiguration>? cfgBuilder = null)
Parameters
hostSection
stringargs
string[]cfgBuilder
Action<IHostBuilder, IConfiguration>
Returns
CreateAppHostBuilder(string[]?, Action<IHostBuilder, IConfiguration>?)
Create a IHostBuilder from optional command line args
.
public static IHostBuilder CreateAppHostBuilder(string[]? args = null, Action<IHostBuilder, IConfiguration>? cfgBuilder = null)
Parameters
args
string[]cfgBuilder
Action<IHostBuilder, IConfiguration>
Returns
CreateLogFactory(IConfigurationSection)
Create a ILoggerFactory from config section logConfig
public static ILoggerFactory CreateLogFactory(IConfigurationSection logConfig)
Parameters
logConfig
IConfigurationSection
Returns
InitLog<T>(Assembly?)
Creates an application logger (and intital log output).
public static ILogger<T> InitLog<T>(Assembly? entryAsm = null)
Parameters
entryAsm
AssemblyEntry assembly
Returns
- ILogger<T>
Type Parameters
T
Application type