From 028a175286c1c88e51a95e6cadadeafdf60c4d84 Mon Sep 17 00:00:00 2001 From: Eric Green Date: Sat, 1 Oct 2016 13:28:02 -0500 Subject: [PATCH] Added IGlobalConfiguration overloads to UsePostgreSqlStorage --- ...eSqlBootstrapperConfigurationExtensions.cs | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/Hangfire.PostgreSql.NetCore/PostgreSqlBootstrapperConfigurationExtensions.cs b/src/Hangfire.PostgreSql.NetCore/PostgreSqlBootstrapperConfigurationExtensions.cs index ca51e8f2..60d50a13 100644 --- a/src/Hangfire.PostgreSql.NetCore/PostgreSqlBootstrapperConfigurationExtensions.cs +++ b/src/Hangfire.PostgreSql.NetCore/PostgreSqlBootstrapperConfigurationExtensions.cs @@ -58,5 +58,41 @@ public static PostgreSqlStorage UsePostgreSqlStorage( return storage; } - } + + /// + /// Tells the bootstrapper to use PostgreSQL as a job storage, + /// that can be accessed using the given connection string or + /// its name. + /// + /// Configuration + /// Connection string or its name + public static PostgreSqlStorage UsePostgreSqlStorage( + this IGlobalConfiguration configuration, + string nameOrConnectionString) + { + var storage = new PostgreSqlStorage(nameOrConnectionString); + configuration.UseStorage(storage); + + return storage; + } + + /// + /// Tells the bootstrapper to use PostgreSQL as a job storage + /// with the given options, that can be accessed using the specified + /// connection string or its name. + /// + /// Configuration + /// Connection string or its name + /// Advanced options + public static PostgreSqlStorage UsePostgreSqlStorage( + this IGlobalConfiguration configuration, + string nameOrConnectionString, + PostgreSqlStorageOptions options) + { + var storage = new PostgreSqlStorage(nameOrConnectionString, options); + configuration.UseStorage(storage); + + return storage; + } + } } \ No newline at end of file