Skip to content

License Key Configuration

Jimmy Bogard edited this page Aug 22, 2025 · 1 revision

MediatR is dual licensed. To configure the commercial license, either the license key can be set using Microsoft.Extensions.DependencyInjection integration:

services.AddMediatR(cfg => {
    cfg.LicenseKey = "License key here";

    // Other configuration
});

Or on non-MS.Ext.DI scenarios, where you're configuring a 3rd-party container directly, you can set the license key with a static property:

Mediator.LicenseKey = "License key here";

You can obtain a valid license from the MediatR website.

License Enforcement

Licensing is enforced via log messages at various levels:

  • INFO: Valid license message
  • WARNING: Missing license message
  • ERROR: Invalid/expired license message

There is no other license enforcement besides log messages. No central license server, no outbound HTTP calls, no degrading or disabling of features.

The log messages are logged using standard Microsoft.Extensions.Logging loggers under the category name LuckyPennySoftware.MediatR.License.

Client Redistribution Scenarios

In the case where MediatR is used on a client, including:

  • Blazor WASM
  • WPF/MAUI/Desktop apps
  • Redistributed clients

The license key should NOT be set as this would result in secrets transmitted to the client. Instead, omit the license key configuration and mute the license message category name using:

builder.Logging.AddFilter("LuckyPennySoftware.MediatR.License", LogLevel.None);

This will depend on your logging setup. A missing/invalid license key does not affect runtime behavior in any way.

Clone this wiki locally