From da70571ae83a2d83f93e45c0beb2a38a633a90d6 Mon Sep 17 00:00:00 2001 From: Bradley Grainger Date: Mon, 18 Dec 2023 08:09:07 -0800 Subject: [PATCH] Remove unnecessary precondition checks (#2129) * Remove unnecessary precondition checks. The public constructors prevent the object from being in this state. Signed-off-by: Bradley Grainger * Simplify constructor. Co-authored-by: Adam Sitnik --------- Signed-off-by: Bradley Grainger Co-authored-by: Adam Sitnik --- src/HealthChecks.MySql/MySqlHealthCheck.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/HealthChecks.MySql/MySqlHealthCheck.cs b/src/HealthChecks.MySql/MySqlHealthCheck.cs index e12009cb2d..8a009836ac 100644 --- a/src/HealthChecks.MySql/MySqlHealthCheck.cs +++ b/src/HealthChecks.MySql/MySqlHealthCheck.cs @@ -12,12 +12,7 @@ public class MySqlHealthCheck : IHealthCheck public MySqlHealthCheck(MySqlHealthCheckOptions options) { - Guard.ThrowIfNull(options); - if (options.DataSource is null && options.ConnectionString is null) - throw new InvalidOperationException("One of options.DataSource or options.ConnectionString must be specified."); - if (options.DataSource is not null && options.ConnectionString is not null) - throw new InvalidOperationException("Only one of options.DataSource or options.ConnectionString must be specified."); - _options = options; + _options = Guard.ThrowIfNull(options); } ///