29 lines
995 B
C#
29 lines
995 B
C#
|
|
using Npgsql;
|
|||
|
|
|
|||
|
|
namespace pgLabII.PgUtils.ConnectionStrings;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Canonical, format-agnostic representation of a PostgreSQL connection.
|
|||
|
|
/// Keep minimal fields for broad interoperability; store extras in Properties.
|
|||
|
|
/// </summary>
|
|||
|
|
public sealed class ConnectionDescriptor
|
|||
|
|
{
|
|||
|
|
public string? Name { get; init; }
|
|||
|
|
|
|||
|
|
// Primary hosts (support multi-host). If empty, implies localhost default.
|
|||
|
|
public IReadOnlyList<HostEndpoint> Hosts { get; init; } = new List<HostEndpoint>();
|
|||
|
|
|
|||
|
|
public string? Database { get; init; }
|
|||
|
|
public string? Username { get; init; }
|
|||
|
|
public string? Password { get; init; }
|
|||
|
|
|
|||
|
|
public SslMode? SslMode { get; init; }
|
|||
|
|
|
|||
|
|
// Common optional fields
|
|||
|
|
public string? ApplicationName { get; init; }
|
|||
|
|
public int? TimeoutSeconds { get; init; } // connect_timeout
|
|||
|
|
|
|||
|
|
// Additional parameters preserved across conversions
|
|||
|
|
public IReadOnlyDictionary<string, string> Properties { get; init; } =
|
|||
|
|
new Dictionary<string, string>();
|
|||
|
|
}
|