diff --git a/src/dbup-postgresql/PostgresqlConnectionManager.cs b/src/dbup-postgresql/PostgresqlConnectionManager.cs index 8a10b3d..e5e56e7 100644 --- a/src/dbup-postgresql/PostgresqlConnectionManager.cs +++ b/src/dbup-postgresql/PostgresqlConnectionManager.cs @@ -39,6 +39,17 @@ public PostgresqlConnectionManager(string connectionString, X509Certificate2 cer { } +#if (NETSTANDARD2_0_OR_GREATER || NET462_OR_GREATER) + /// + /// Creates a new PostgreSQL database connection with a NpgsqlDatasource + /// + /// The PostgreSQL NpgsqlDataSource. + public PostgresqlConnectionManager(NpgsqlDataSource datasource) + : base(new DelegateConnectionFactory(l => datasource.CreateConnection())) + { + } +#endif + /// /// Splits the statements in the script using the ";" character. /// diff --git a/src/dbup-postgresql/Properties/AssemblyInfo.cs b/src/dbup-postgresql/Properties/AssemblyInfo.cs index 67961a0..4a03b1c 100644 --- a/src/dbup-postgresql/Properties/AssemblyInfo.cs +++ b/src/dbup-postgresql/Properties/AssemblyInfo.cs @@ -2,7 +2,13 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] + +#if (NETSTANDARD2_0_OR_GREATER || NET462_OR_GREATER) +// Npgsql is not CLS compliant and PostgresqlConnectionManager exposes types like NpgsqlDataSource +[assembly: CLSCompliant(false)] +#else [assembly: CLSCompliant(true)] +#endif // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")] diff --git a/src/dbup-postgresql/dbup-postgresql.csproj b/src/dbup-postgresql/dbup-postgresql.csproj index ef3496a..e7ff7e2 100644 --- a/src/dbup-postgresql/dbup-postgresql.csproj +++ b/src/dbup-postgresql/dbup-postgresql.csproj @@ -19,7 +19,9 @@ - + + +