diff --git a/src/dbup-postgresql/PostgresqlExtensions.cs b/src/dbup-postgresql/PostgresqlExtensions.cs index 00bbe66..8e8448c 100644 --- a/src/dbup-postgresql/PostgresqlExtensions.cs +++ b/src/dbup-postgresql/PostgresqlExtensions.cs @@ -247,14 +247,13 @@ public static UpgradeEngineBuilder JournalToPostgresqlTable(this UpgradeEngineBu internal static void ApplyConnectionOptions(this NpgsqlConnection connection, PostgresqlConnectionOptions connectionOptions) { - if (connectionOptions?.ClientCertificate != null) + connection.SslClientAuthenticationOptionsCallback = options => { - connection.ProvideClientCertificatesCallback += - certs => certs.Add(connectionOptions.ClientCertificate); - } - if (connectionOptions?.UserCertificateValidationCallback != null) - { - connection.UserCertificateValidationCallback = connectionOptions.UserCertificateValidationCallback; - } + if (connectionOptions?.ClientCertificate != null) + options.ClientCertificates = new X509Certificate2Collection(connectionOptions.ClientCertificate); + + if (connectionOptions?.UserCertificateValidationCallback != null) + options.RemoteCertificateValidationCallback = connectionOptions.UserCertificateValidationCallback; + }; } } diff --git a/src/dbup-postgresql/dbup-postgresql.csproj b/src/dbup-postgresql/dbup-postgresql.csproj index 8996e15..f121447 100644 --- a/src/dbup-postgresql/dbup-postgresql.csproj +++ b/src/dbup-postgresql/dbup-postgresql.csproj @@ -6,7 +6,7 @@ DbUp Contributors DbUp Copyright © DbUp Contributors 2015 - netstandard2.0 + net8.0 dbup-postgresql DbUp.Postgresql dbup-postgresql @@ -24,7 +24,7 @@ - +