/// <summary> /// Gets the hangfire dashboard options. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sectionName">The hangfire configuration section name.</param> /// <param name="subSectionName">The hangfire dashboard configuration sub section name.</param> /// <returns>The hangfire dashboard options.</returns> public static DashboardOptions GetHangfireDashboardOptions(this IConfiguration configuration, string sectionName, string subSectionName) { // Validate arguments. if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (string.IsNullOrWhiteSpace(sectionName)) { throw new ArgumentException("The specified string argument cannot be null, empty or whitespace.", nameof(sectionName)); } if (string.IsNullOrWhiteSpace(subSectionName)) { throw new ArgumentException("The specified string argument cannot be null, empty or whitespace.", nameof(subSectionName)); } // Load options from configuration object. var result = ConfigurationExtensions.LoadOptions <DashboardOptions>(configuration, sectionName, subSectionName); // If AppPath is null or white space then... if (string.IsNullOrWhiteSpace(result.AppPath)) { // Make white space always null. result.AppPath = null; } // Return the result. return(result); }
/// <summary> /// Gets the hangfire background job server options. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sectionName">The hangfire configuration section name.</param> /// <param name="subSectionName">The hangfire server configuration sub section name.</param> /// <returns>The hangfire background job server options.</returns> public static BackgroundJobServerOptions GetHangfireBackgroundJobServerOptions(this IConfiguration configuration, string sectionName, string subSectionName) { // Validate arguments. if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (string.IsNullOrWhiteSpace(sectionName)) { throw new ArgumentException("The specified string argument cannot be null, empty or whitespace.", nameof(sectionName)); } if (string.IsNullOrWhiteSpace(subSectionName)) { throw new ArgumentException("The specified string argument cannot be null, empty or whitespace.", nameof(subSectionName)); } // Load options from configuration object. var result = ConfigurationExtensions.LoadOptions <BackgroundJobServerOptions>(configuration, sectionName, subSectionName); // If there is more than one queue then... if (result.Queues.Length > 1) { // remove the default queue. result.Queues = result.Queues.Skip(1).ToArray(); } // If ServerName is null or white space then... if (string.IsNullOrWhiteSpace(result.ServerName)) { // Make white space always null. result.ServerName = null; } // Return the result. return(result); }
/// <summary> /// Gets the hangfire background job server options. /// </summary> /// <param name="configuration">The configuration.</param> /// <returns>The hangfire background job server options.</returns> public static BackgroundJobServerOptions GetHangfireBackgroundJobServerOptions(this IConfiguration configuration) { return(ConfigurationExtensions.GetHangfireBackgroundJobServerOptions(configuration, DEFAULT_SECTION_NAME)); }
/// <summary> /// Gets the hangfire dashboard options. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sectionName">The hangfire configuration section name.</param> /// <returns>The hangfire dashboard options.</returns> public static DashboardOptions GetHangfireDashboardOptions(this IConfiguration configuration, string sectionName) { return(ConfigurationExtensions.GetHangfireDashboardOptions(configuration, sectionName, DEFAULT_DASHBOARD_SUB_SECTION_NAME)); }
/// <summary> /// Gets the hangfire dashboard options. /// </summary> /// <param name="configuration">The configuration.</param> /// <returns>The hangfire dashboard options.</returns> public static DashboardOptions GetHangfireDashboardOptions(this IConfiguration configuration) { return(ConfigurationExtensions.GetHangfireDashboardOptions(configuration, DEFAULT_SECTION_NAME)); }
/// <summary> /// Gets the hangfire background job server options. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="sectionName">The hangfire configuration section name.</param> /// <returns>The hangfire background job server options.</returns> public static BackgroundJobServerOptions GetHangfireBackgroundJobServerOptions(this IConfiguration configuration, string sectionName) { return(ConfigurationExtensions.GetHangfireBackgroundJobServerOptions(configuration, sectionName, DEFAULT_SERVER_SUB_SECTION_NAME)); }