0
votes

I'm using NServiceBus with Azure service bus transport. Currently, I provide the connection string for the queue in the app.config like this:

<add name="NServiceBus/Transport" connectionString="Endpoint=..." />

I need to supply this in code, not in configuration. I'm using the code on this page as an example of how to do this, but where they use RijndaelEncryptionServiceConfig as an example, I have no idea what type(s) to use for overriding the transport connection string. To be specific, I have no idea what to put here:

    // the part you are overriding
    if (typeof(T) == typeof(RijndaelEncryptionServiceConfig))
    {
        return new RijndaelEncryptionServiceConfig
               {
                   Key = "gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"
               } as T;
    } 

Can someone guide me? Thanks very much.

1

1 Answers

2
votes

I was totally barking up the wrong tree. This works:

var busConfiguration = new BusConfiguration();
busConfiguration.UseTransport<AzureServiceBusTransport>().ConnectionString(@"Endpoint=sb:...");

Simple! I was overthinking it.