This commit reorganizes namespaces from `DigitalData.Core.Abstractions` and `DigitalData.Core.DTO` to `DigitalData.Core.Application.Interfaces` and `DigitalData.Core.Application.DTO`, improving maintainability and clarity. Updated using directives across multiple files to reflect the new structure, ensuring functionality remains intact. Project references in `DigitalData.Core.API.csproj` have been consolidated to include the new Application project. Introduced new classes and interfaces such as `BaseDTO`, `CookieConsentSettings`, `DataResult`, `Notice`, and `Result` to enhance data transfer and service result handling. Updated `IRepository`, `ICRUDRepository`, and `IEntityMapper` interfaces to facilitate CRUD operations and entity mapping. Added extension methods in `Extensions.cs` to improve repository usability. New interfaces for HTTP client services have been added, enhancing external API call handling. Overall, these changes reflect a significant restructuring aimed at improving organization and preparing for future development.
33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Configuration;
|
|
|
|
namespace DigitalData.Core.Application.DTO
|
|
{
|
|
/// <summary>
|
|
/// Provides extension methods for dependency injection.
|
|
/// </summary>
|
|
public static class DIExtensions
|
|
{
|
|
/// <summary>
|
|
/// Adds the <see cref="CookieConsentSettings"/> to the service collection.
|
|
/// </summary>
|
|
/// <param name="services">The service collection to add the settings to.</param>
|
|
/// <returns>The updated service collection.</returns>
|
|
/// <exception cref="ConfigurationErrorsException">
|
|
/// Thrown if the 'CookieConsentSettings' section is missing or improperly configured in appsettings.json.
|
|
/// </exception>
|
|
public static IServiceCollection AddCookieConsentSettings(this IServiceCollection services)
|
|
{
|
|
services.AddSingleton(sp =>
|
|
{
|
|
var configuration = sp.GetRequiredService<IConfiguration>();
|
|
var settings = configuration.GetSection("CookieConsentSettings").Get<CookieConsentSettings>();
|
|
return settings is null
|
|
? throw new ConfigurationErrorsException("The 'CookieConsentSettings' section is missing or improperly configured in appsettings.json.")
|
|
: settings;
|
|
});
|
|
return services;
|
|
}
|
|
}
|
|
} |