Exemplo n.º 1
0
 public ServicesController(
     IServiceManagementProvider serviceManagementProvider,
     IHttpContextAccessor httpContextAccessor)
 {
     _serviceManagementProvider = serviceManagementProvider;
     _httpContextAccessor       = httpContextAccessor;
 }
 public ServiceMonitorService(
     IServiceLogger <ServiceMonitorService> logger,
     IMonitorProvider monitorProvider,
     IServiceManagementProvider serviceManagementProvider)
 {
     _logger                    = logger;
     _monitorProvider           = monitorProvider;
     _serviceManagementProvider = serviceManagementProvider;
 }
 public InternalServiceContext(
     IOptionsMonitor <ServiceOptions> serviceOptions,
     IOptionsMonitor <LoggerOptions> loggerOptions,
     IServiceManagementProvider serviceManagementProvider,
     IMonitorProvider monitorProvider,
     ILogEventProvider logEventProvider)
 {
     _serviceOptions            = serviceOptions;
     _loggerOptions             = loggerOptions;
     _serviceManagementProvider = serviceManagementProvider;
     _monitorProvider           = monitorProvider;
     _logEventProvider          = logEventProvider;
 }
Exemplo n.º 4
0
 public ServerServiceContext(
     SelfServerOptions selfOptions,
     IOptionsMonitor <LoggerOptions> loggerOptions,
     IOptionsMonitor <MonitorOptions> monitorOptions,
     IServiceManagementProvider serviceManagementProvider,
     IMonitorProvider monitorProvider,
     ILogEventProvider logEventProvider)
 {
     _loggerOptions             = loggerOptions;
     _monitorOptions            = monitorOptions;
     _serviceManagementProvider = serviceManagementProvider;
     _monitorProvider           = monitorProvider;
     _logEventProvider          = logEventProvider;
     _selfOptions   = selfOptions;
     runningVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
 }
Exemplo n.º 5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
        {
            if (serviceManagementProvider == null)
            {
                serviceManagementProvider = app?.ApplicationServices.GetService <IServiceManagementProvider>();
            }

            if (!isExistedDB)
            {
                var databaseOptions = app?.ApplicationServices.GetService <DatabaseOptions>();
                if (databaseOptions.ConnectionType != ConnectionType.MongoDB)
                {
                    using var letportalDbContext = app.ApplicationServices.GetService <LetPortalServiceManagementDbContext>();
                    letportalDbContext.Database.EnsureCreated();
                    isExistedDB = true;
                }
                else
                {
                    isExistedDB = true;
                }
            }

            applicationLifetime?.ApplicationStarted.Register(OnStart);
            applicationLifetime?.ApplicationStopping.Register(OnStop);
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }