Endpoint config for different environment

In the documentation, it is recommend to use “Code Only” configuration for service end point.
It seems different from other common practice, what is the reason behind this recommendation?
And what is the best practice in handling the different Environment configuration while using Code only approach?

In previous versions, NServiceBus supported XML configuration (in app.config or web.config) for most of the configuration.

One of the most important reasons is that customers didn’t always want to store configuration in those XML files, but rather a database or other centralized storage solution. Now those customers are able to do that.

Another reason is the expectation was that System.Configuration namespace would’ve been removed from .NET Core completely. So in preparation of NServiceBus v7 we started replacing the XML configuration with code config.

The idea is that with code configuration, you’ll have more opportunities to do configuration. You might still put it in a web.config with XML, but you could also use environment variables or any of the new features in .NET.

Does that make sense?

1 Like

Thanks, that make sense!