If npgsql driver version 7+
https://www.npgsql.org/doc/failover-and-load-balancing.html?tabs=7
Target Session Attributes=prefer-standby -> Target Session Attributes=PreferStandby
And:
// At startup: _preferStandbyDatASource = dataSource.WithTargetSession(TargetSessionAttributes.PreferStandby); // ... and wherever you need a connection: await using var connection = await _preferStandbyDatASource.OpenConnectionAsync();