AspNetCore.Pulse.NpgSql 8.0.5

dotnet add package AspNetCore.Pulse.NpgSql --version 8.0.5                
NuGet\Install-Package AspNetCore.Pulse.NpgSql -Version 8.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AspNetCore.Pulse.NpgSql" Version="8.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.Pulse.NpgSql --version 8.0.5                
#r "nuget: AspNetCore.Pulse.NpgSql, 8.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AspNetCore.Pulse.NpgSql as a Cake Addin
#addin nuget:?package=AspNetCore.Pulse.NpgSql&version=8.0.5

// Install AspNetCore.Pulse.NpgSql as a Cake Tool
#tool nuget:?package=AspNetCore.Pulse.NpgSql&version=8.0.5                

PostgreSQL

This health check verifies the ability to communicate with PostgreSQL. It uses the Npgsql library.

NpgsqlDataSource

Starting with Npgsql 7.0 (and .NET 7), the starting point for any database operation is NpgsqlDataSource. The data source represents your PostgreSQL database, and can hand out connections to it, or support direct execution of SQL against it. The data source encapsulates the various Npgsql configuration needed to connect to PostgreSQL, as well as the connection pooling which makes Npgsql efficient.

Npgsql's data source supports additional configuration beyond the connection string, such as logging, advanced authentication options, type mapping management, and more.

To take advantage of the performance NpgsqlDataSource has to offer, it should be used as a singleton. Otherwise, the app might end up with having multiple data source instances, all of which would have their own connection pools. This can lead to resources exhaustion and major performance issues (Example: #1993).

We encourage you to use Npgsql.DependencyInjection package for registering a singleton factory for NpgsqlDataSource. It allows easy configuration of your Npgsql connections and registers the appropriate services in your DI container.

To make the shift to NpgsqlDataSource as easy as possible, the Npgsql.DependencyInjection package registers not just a factory for the data source, but also factory for NpgsqlConnection (and even DbConnection). So, your app does not need to suddenly start using NpgsqlDataSource everywhere.

void Configure(IServiceCollection services)
{
    services.AddNpgsqlDataSource("Host=pg_server;Username=test;Password=test;Database=test");
    services.AddHealthChecks().AddNpgSql();
}

By default, the NpgsqlDataSource instance is resolved from service provider. If you need to access more than one PostgreSQL database, you can use keyed DI services to achieve that:

void Configure(IServiceCollection services)
{
    services.AddNpgsqlDataSource("Host=pg_server;Username=test;Password=test;Database=first", serviceKey: "first");
    services.AddHealthChecks().AddNpgSql(sp => sp.GetRequiredKeyedService<NpgsqlDataSource>("first"));

    services.AddNpgsqlDataSource("Host=pg_server;Username=test;Password=test;Database=second", serviceKey: "second");
    services.AddHealthChecks().AddNpgSql(sp => sp.GetRequiredKeyedService<NpgsqlDataSource>("second"));
}

Connection String

Raw connection string is of course still supported:

services.AddHealthChecks().AddNpgSql("Host=pg_server;Username=test;Password=test;Database=test");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.5 115 6/2/2024
8.0.4 94 6/2/2024
8.0.3 98 5/26/2024
8.0.2 90 5/26/2024
8.0.1 87 5/26/2024