IConnectionStringProvider CreateConfigPerEndpointConnectionStringProvider(LocalConnectionParams localConnectionParams) { const string transportConnectionStringPrefix = "NServiceBus/Transport/"; var configConnectionStrings = connectionStrings .Where(x => x.Name.StartsWith(transportConnectionStringPrefix)) .Select(x => { string schema; var connectionString = x.ConnectionString.ExtractSchemaName(out schema); var endpoint = x.Name.Replace(transportConnectionStringPrefix, String.Empty); var connectionInfo = EndpointConnectionInfo.For(endpoint).UseSchema(schema); var localConnectionStringBuilder = new DbConnectionStringBuilder { ConnectionString = localConnectionParams.ConnectionString }; var overriddenConnectionStringBuilder = new DbConnectionStringBuilder { ConnectionString = connectionString }; if (!localConnectionStringBuilder.EquivalentTo(overriddenConnectionStringBuilder)) { connectionInfo = connectionInfo.UseConnectionString(connectionString); } return connectionInfo; }) .ToArray(); return new CollectionConnectionStringProvider(configConnectionStrings, localConnectionParams); }