mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 09:01:10 +00:00
- 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.
28 lines
1.3 KiB
C#
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
|
|
} |