Added a call to `services.AddHttpClient();` in the `DependencyInjection` class within `DependencyInjection.cs`. This change registers the `HttpClient` service in the dependency injection container, allowing the application to use managed `HttpClient` instances.
35 lines
944 B
C#
35 lines
944 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Reflection;
|
|
|
|
namespace ReC.Application;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddRecServices(this IServiceCollection services, Action<ConfigurationOptions> options)
|
|
{
|
|
var configOpt = new ConfigurationOptions();
|
|
options.Invoke(configOpt);
|
|
|
|
services.AddAutoMapper(cfg =>
|
|
{
|
|
cfg.AddMaps(Assembly.GetExecutingAssembly());
|
|
cfg.LicenseKey = configOpt.LuckyPennySoftwareLicenseKey;
|
|
});
|
|
|
|
services.AddMediatR(cfg =>
|
|
{
|
|
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
|
|
cfg.LicenseKey = configOpt.LuckyPennySoftwareLicenseKey;
|
|
});
|
|
|
|
services.AddHttpClient();
|
|
|
|
return services;
|
|
}
|
|
|
|
public class ConfigurationOptions
|
|
{
|
|
public string? LuckyPennySoftwareLicenseKey { get; set; }
|
|
}
|
|
}
|