private IConfigurationContext MergeConfiguration(IConfigurationContext context) { var defaultSettings = new Configuration.ConfigurationSettings(); var configSection = ConfigurationHelper.GetConfigSection <Configuration.ConfigurationSection>(); // If the value is in the config use that // Otherwise, if the value is already set via fluent config use that // Otherwise use the default value if (configSection != null) { if (!String.IsNullOrWhiteSpace(configSection.ConnectionStringName)) { context.SetConnectionString(ConfigurationManager.ConnectionStrings[configSection.ConnectionStringName].ConnectionString); } else if (context.GetConnectionString() == null) { context.SetConnectionString(defaultSettings.ConnectionString); } if (!String.IsNullOrWhiteSpace(configSection.Exchange)) { context.SetExchange(configSection.Exchange); } else if (context.GetExchange() == null) { context.SetExchange(defaultSettings.Exchange); } } return(context); }
public static FluentConfigurationSource UseRabbitMQ(this FluentConfigurationSource builder, Action<ConfigurationSettings> settingsFactory) { var settings = new ConfigurationSettings(); settingsFactory(settings); return builder.UsingTransport<RabbitMQTransport>(context => { context.SetAutoDeleteQueues(settings.AutoDeleteQueues); context.SetConnectionString(settings.ConnectionString); context.SetExchange(settings.Exchange); }); }