Removed the IServiceCollection dependency and related code from MessagingServiceApplicationConfiguration.cs. This includes the private property `Services`, the boolean field `_luckyPennySoftLicenseKeyAdded`, and the constructor that initialized `Services`. The `EnsureConfigured` method remains, but its functionality may be impacted by these changes.
37 lines
1.4 KiB
C#
37 lines
1.4 KiB
C#
#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<string>(key) ?? string.Empty);
|
|
}
|
|
#endregion LuckyPennySoftLicenseKey
|
|
}
|
|
#endif |