Enforcement of best practices

Component: NServiceBus
NuGet Package: NServiceBus (8-pre)
This page targets a pre-release version. Pre-releases are subject to change and samples are not guaranteed to be fully functional.

By default, messaging best practices are enforced for messages defined as either commands or events.

In NServiceBus versions 6 and above, the default behavior can be overridden.

This feature can be disabled at the endpoint level using:

var routing = endpointConfiguration.UseTransport(new TransportDefinition());
routing.DoNotEnforceBestPractices();

or at the message level using:

var options = new SendOptions();

options.DoNotEnforceBestPractices();

await context.Send(new MyEvent(), options)
    .ConfigureAwait(false);

Last modified