Files
Nemera/src/Lumina.Infrastructure/Common/DependencyInjection/InfrastructureLayerServices.cs
T
BinaryAlley 433f0c2ad5 Adds strongly typed IOptions<T> binding, with Fluent Validation and shared appsettings
- Adds strongly typed binding for IOptions<T> to map configuration sections from appsettings.json.
- Integrates FluentValidation for validating bound properties.
- Introduces appsettings.shared.json for shared configurations across applications.
Updates application-specific appsettings.json to focus on individual settings.
2024-08-25 16:59:19 +03:00

28 lines
1.3 KiB
C#

#region ========================================================================= USING =====================================================================================
using System.Reflection;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
#endregion
namespace Lumina.Infrastructure.Common.DependencyInjection;
/// <summary>
/// Contains all services of the Infrastructure layer.
/// </summary>
public static class InfrastructureLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Extension method for adding the Infrastructure layer services to the DI container.
/// </summary>
/// <param name="services">The service collection to add the services to.</param>
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection AddInfrastructureLayerServices(this IServiceCollection services)
{
// scan the current assembly for validators and add them to the DI container
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly(), ServiceLifetime.Singleton);
return services;
}
#endregion
}