private static void ValidateConfig(EventHubConfig config, string eventHubType) { if (string.IsNullOrEmpty(config.ConnectionString)) { Logger.LogError(string.Format("Missing value in app.config for {0} EventHub.", eventHubType), true); } }
public static EventHubConfig GetDestinationEventHubConfig() { EventHubConfig eventHubConfig = new EventHubConfig() { ConnectionString = ConfigurationManager.AppSettings["destEhConnStr"] }; ValidateConfig(eventHubConfig, "Destination"); return(eventHubConfig); }
public static EventHubConfig GetDestinationEventHubConfig(ILogger logger) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } EventHubConfig eventHubConfig = new EventHubConfig() { ConnectionString = ConfigurationManager.AppSettings["destEhConnStr"] }; ValidateConfig(logger, eventHubConfig, "Destination"); return(eventHubConfig); }
private static void ValidateConfig( ILogger logger, EventHubConfig config, string eventHubType) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (string.IsNullOrEmpty(config.ConnectionString)) { string message = $"Missing value in app.config for '{eventHubType}' EventHub."; logger.LogError(message); throw new NotSupportedException(message); } }