/// <summary> /// Runs the health check with the given name. /// </summary> /// <param name="name"> the health check's name</param> /// <returns>the result of the health check</returns> public HealthCheck.Result RunHealthCheck(string name) { HealthCheck healthCheck = null; if (!_checks.TryGetValue(name, out healthCheck)) { throw new InvalidOperationException("Given health check not found"); } return(healthCheck.Execute()); }
/// <summary> /// Registers an application <see cref="HealthCheck" /> with a given name /// </summary> /// <param name="name">The named health check instance</param> /// <param name="check">The <see cref="HealthCheck" /> function</param> public void Register(string name, HealthCheck check) { _checks.TryAdd(name, check); }
/// <summary> /// Registers an application <see cref="HealthCheck" /> with a given name /// </summary> /// <param name="name">The named health check instance</param> /// <param name="check">The <see cref="HealthCheck" /> function</param> public void Register(string name, HealthCheck check) { _checks.TryAdd(name, check); }