2025-01-21 17:40:23 +01:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
namespace Core.Configurations.PostgresqlConfigurationBuilder
|
|
|
|
|
|
{
|
2025-01-22 17:30:10 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// LISTEN / NOTIFY in Postgresql
|
|
|
|
|
|
/// </summary>
|
2025-01-21 17:40:23 +01:00
|
|
|
|
public static class PostgresConfigurationExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static IConfigurationBuilder AddPostgresConfiguration(
|
|
|
|
|
|
this IConfigurationBuilder builder,
|
|
|
|
|
|
Action<PostgresConfigurationOptions> setupAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
var options = new PostgresConfigurationOptions();
|
|
|
|
|
|
setupAction(options);
|
|
|
|
|
|
|
|
|
|
|
|
builder.Add(new PostgresConfigurationSource(
|
|
|
|
|
|
options.ConnectionString,
|
|
|
|
|
|
options.Channel,
|
|
|
|
|
|
options.ConfigurationQuery));
|
|
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class PostgresConfigurationOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
public string ConnectionString { get; set; }
|
|
|
|
|
|
public string Channel { get; set; }
|
|
|
|
|
|
public string ConfigurationQuery { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|