#if NET using Microsoft.Extensions.Configuration; namespace DigitalData.MessagingService.Application.DependencyInjection; public partial class MessagingServiceApplicationConfiguration { private bool _luckyPennySoftLicenseKeyAdded = false; internal void EnsureConfigured() { if (!_luckyPennySoftLicenseKeyAdded) { throw new InvalidOperationException("LuckyPennySoftLicenseKey is not configured. Please call SetLuckyPennySoftLicenseKey() or SetLuckyPennySoftLicenseKey(IConfiguration) in DI configuration."); } } #region LuckyPennySoftLicenseKey internal string? LuckyPennySoftLicenseKey { get; set; } = null; public MessagingServiceApplicationConfiguration SetLuckyPennySoftLicenseKey(string licenseKey) { if (string.IsNullOrWhiteSpace(licenseKey)) throw new InvalidOperationException("LuckyPennySoftLicenseKey is not configured. Please call SetLuckyPennySoftLicenseKey() or SetLuckyPennySoftLicenseKey(IConfiguration) in DI configuration."); LuckyPennySoftLicenseKey = licenseKey; _luckyPennySoftLicenseKeyAdded = true; return this; } public MessagingServiceApplicationConfiguration SetLuckyPennySoftLicenseKey(IConfiguration configuration, string key = "LuckyPennySoftLicenseKey") { return SetLuckyPennySoftLicenseKey(configuration.GetValue(key) ?? string.Empty); } #endregion LuckyPennySoftLicenseKey } #endif