Ejemplo n.º 1
0
 protected virtual void ConfigureServices(HostBuilderContext hostBuilder, IServiceCollection svcs)
 {
     hostBuilder.EnsureNotNull(nameof(hostBuilder));
     svcs.EnsureNotNull(nameof(svcs));
     //
     svcs.AddDefaultXAppRuntimeServiceFactory();
     svcs.AddDefaultDescriptionPackageService();
 }
Ejemplo n.º 2
0
 protected virtual void ConfigureLogging(HostBuilderContext hostBuilder, ILoggingBuilder logging)
 {
     hostBuilder.EnsureNotNull(nameof(hostBuilder));
     logging.EnsureNotNull(nameof(logging));
     //
     logging.AddConsole();
     if (UseDebugLogging)
     {
         logging.AddDebug();
     }
 }
Ejemplo n.º 3
0
        protected virtual void ConfigureAppConfiguration(HostBuilderContext hostBuilder, IConfigurationBuilder appConfig, string[] commandLineArgs = default)
        {
            hostBuilder.EnsureNotNull(nameof(hostBuilder));
            appConfig.EnsureNotNull(nameof(appConfig));
            //
            var appSettingsJsonFilePath = AppSettingsJsonFilePath;

            appConfig.AddJsonFile(path: appSettingsJsonFilePath, optional: true);
            var hostingEnvironment = hostBuilder.HostingEnvironment.EnvironmentName;

            if (!string.IsNullOrWhiteSpace(hostingEnvironment))
            {
                appConfig.AddJsonFile(Path.ChangeExtension(path: appSettingsJsonFilePath, extension: $"{hostingEnvironment.ToLowerInvariant()}.json"), optional: true);
            }
            appConfig.AddEnvironmentVariables(prefix: EnvironmentVariablePrefix);
            if (!(commandLineArgs is null))
            {
                appConfig.AddCommandLine(args: commandLineArgs);
            }
        }