35 lines
866 B
C#
35 lines
866 B
C#
|
|
using Microsoft.Extensions.Configuration;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace Core.Configurations.PostgresqlConfigurationBuilder
|
|||
|
|
{
|
|||
|
|
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; }
|
|||
|
|
}
|
|||
|
|
}
|