Particular/NServiceBus.SqlServer — pull request #66 by SzymonPobiega (2014-12-05 21:31:58+00:00)
Title: Using non-default schema on per-endpoint basis

This pull extends the support for per-endpoint connection strings with possibility to also set non-default (other than `dbo`) schema for creating queue tables

### Configuration source priorities

When determining the connection string and schema for a given outgoing message, following sources of configuration are checked:
1. `NServiceBus/Transport/` connection string in the `app.config` file. An extended property `Queue Schema` can be used to specify the schema
2. Data supplied via `UseSpecificConnectionInformation` method. If both collection and callback is provided, collection is used
3. Connection string specified via `ConnectionString()` method / schema specified via `DefaultSchema()` method when configuring the transport
4. `NServiceBus/Transport` connection string in the `app.config` file. An extended property `Queue Schema` can be used to specify the schema.

### API

- Setting the default schema for current/this endpoint

```
busConfig.UseTransport().DefaultSchema("sender")
```
The queue table for this endpoint will be created in schema `sender` instead of `dbo`. This schema (`sender`) will also be used as default when sending messages to other endpoints
- Overriding the default connection string or schema for a remote endpoint

```
busConfig.UseTransport().UseSpecificConnectionInformation(
EndpointConnectionInfo.For("RemoteEndpoint").UseSchema("receiver").UseConnectionString("SomeConnectionString")
))
```
or

```
busConfig.UseTransport()
.UseSpecificConnectionInformation(x =>
{
return x == "RemoteEndpoint"
? ConnectionInfo.Create().UseConnectionString(ReceiverConnectionString).UseSchema("nsb")
: null;
})
```
When sending a message to `RemoteEndpoint` the default schema and connection string will be overridden by above values