public static void Initialize(DBBAppConfiguration dBBAppConfiguration, TraceService traceService) { Environment.SetEnvironmentVariable("TraceLevel", dBBAppConfiguration.defaultAppConfiguration.GetSection("app:TraceLevel").Value); Environment.SetEnvironmentVariable("InstanceTimeoutInSeconds", dBBAppConfiguration.defaultAppConfiguration.GetSection("app:TimeoutInSeconds").Value); Environment.SetEnvironmentVariable("ConnectionString", dBBAppConfiguration.dBBCommonConfiguration.MSSQLConnectionString); IServiceCollection serviceCollection = IOCFactory.Initializer; serviceCollection.AddScoped <ITraceService>(Pro => traceService); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { DBBAppConfiguration dBBAppConfiguration = DBBConfiguration.GetConfigValues(); dBBAppConfiguration.dBBCommonConfiguration.schedulerServiceInvocationID = LookupLists.SystemIntegrationServiceType.Values.Transcode.ID; TraceService traceService = new TraceService(dBBAppConfiguration.dBBCommonConfiguration.MSSQLConnectionString, TraceLevel.Database, LookupLists.SystemIntegrationServiceType.Values.Transcode.SystemName); Initialize(dBBAppConfiguration, traceService); services.AddHostedService <ExecutionWorker>(w => new ExecutionWorker(dBBAppConfiguration, traceService)); //not using this... it doesn't make sense! //services.AddHostedService<StatusWorker>(w => new StatusWorker(dBBAppConfiguration, traceService)); });
public StatusWorker(DBBAppConfiguration dBBAppConfiguration, ITraceService traceService, ConsumerHandlerConfig handlerConfig = null, int asyncMessageProcessCount = 1) : base(dBBAppConfiguration.dBBCommonConfiguration.MSSQLConnectionString, dBBAppConfiguration.dBBCommonConfiguration.appSettingMaintenanceModeID, dBBAppConfiguration.dBBCommonConfiguration.schedulerServiceInvocationID, traceService, dBBAppConfiguration.dBBCommonConfiguration.traceLevel, handlerConfig, asyncMessageProcessCount) { _traceService = traceService; }