inject MediatRLicense

This commit is contained in:
2025-07-24 15:41:29 +02:00
parent dc7da91872
commit dd5babfdbe
3 changed files with 17 additions and 3 deletions

View File

@@ -7,8 +7,11 @@ namespace WorkFlow.Application;
public static class DependencyInjection
{
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services)
public static IServiceCollection AddWorkFlowServices(this IServiceCollection services, Action<DIOptions>? options = null)
{
DIOptions diOptions = new();
options?.Invoke(diOptions);
services.AddAutoMapper(typeof(MappingProfile).Assembly);
services.TryAddScoped<IConfigService, ConfigService>();
services.TryAddScoped<IProfileControlsTFService, ProfileControlsTFService>();
@@ -18,8 +21,14 @@ public static class DependencyInjection
services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
cfg.LicenseKey = diOptions.MediatRLicense;
});
return services;
}
public class DIOptions
{
public string MediatRLicense { get; set; } = string.Empty;
}
}