diff --git a/DocumentOperator.Application/DependencyInjection.cs b/DocumentOperator.Application/DependencyInjection.cs
index 4addee1..5f59e2a 100644
--- a/DocumentOperator.Application/DependencyInjection.cs
+++ b/DocumentOperator.Application/DependencyInjection.cs
@@ -1,4 +1,5 @@
using FluentValidation;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace DocumentOperator.Application;
@@ -11,13 +12,18 @@ public static class DependencyInjection
///
/// Registers Application Layer services (MediatR, FluentValidation, AutoMapper, Behaviors)
///
- public static IServiceCollection AddApplication(this IServiceCollection services)
+ public static IServiceCollection AddApplication(this IServiceCollection services, IConfiguration configuration)
{
var assembly = typeof(DependencyInjection).Assembly;
+ // Read LuckyPennySoft license key from appsettings.json
+ var licenseKey = configuration.GetValue("LuckyPennySoftLicenseKey")
+ ?? throw new InvalidOperationException("LuckyPennySoftLicenseKey not found in configuration");
+
// Register MediatR (scannt Assembly nach Handlers)
services.AddMediatR(config =>
{
+ config.LicenseKey = licenseKey;
config.RegisterServicesFromAssembly(assembly);
// Pipeline Behaviors (Reihenfolge wichtig!)
@@ -29,7 +35,9 @@ public static class DependencyInjection
services.AddValidatorsFromAssembly(assembly);
// Register AutoMapper (scannt Assembly nach Profiles)
- services.AddAutoMapper(cfg => { }, typeof(Common.Mapping.MappingProfile));
+ services.AddAutoMapper(cfg => {
+ cfg.LicenseKey = licenseKey;
+ }, typeof(Common.Mapping.MappingProfile));
return services;
}