public async Task <HealthCheckUtilityResult> GetHealthCheckResultAsync()
        {
            var healthCheckResult = new HealthCheckUtilityResult();

            foreach (var healthCheck in _healthChecks)
            {
                healthCheckResult.HealthChecks.Add(await healthCheck.GetHealthAsync().ConfigureAwait(false));
            }
            return(healthCheckResult);
        }
        public async Task <string> Translate(HealthCheckUtilityResult healthCheckUtilityResult)
        {
            var healthCheckUtilityDto = healthCheckUtilityResult.ToDto();

            var engine = new RazorLightEngineBuilder().UseEmbeddedResourcesProject(typeof(Program)).UseMemoryCachingProvider().Build();

            dynamic viewBag = new ExpandoObject();

            viewBag.SiteURL     = _configurationService.ConfigurationSettings.SiteURL;
            viewBag.Environment = _configurationService.ConfigurationSettings.Environment;

            var result = await engine.CompileRenderAsync("Views.Email.NotificationEmail", healthCheckUtilityDto, viewBag).ConfigureAwait(false);

            return(result);
        }
Пример #3
0
        public async Task <Operation> SendNotification(HealthCheckUtilityResult healthCheckUtilityResult)
        {
            var body = await _healthCheckTranslationBehavior.Translate(healthCheckUtilityResult);

            return(await _notificationBehavior.Send(body));
        }