This commit implements a complete rebranding of the project: - Updated all namespaces from `DocumentOperator` to `DocumentService`. - Renamed file paths, embedded resources, and test data references. - Updated configuration keys, logging paths, and Redis instance names. - Revised documentation to reflect the new project name. - Modified project and solution files to align with the new structure. - Updated class names, DTOs, commands, queries, and handlers. - Adjusted middleware, controllers, and API endpoints. - Updated Swagger metadata and API titles to `DocumentService API`. - Refactored test namespaces, resource paths, and embedded resources. - Updated build and deployment configurations for the new name. - Replaced all references to `DocumentOperator` in comments and literals. These changes ensure consistency across the codebase and documentation.
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using FluentValidation;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace DocumentService.Application;
|
|
|
|
/// <summary>
|
|
/// Dependency Injection configuration for Application Layer
|
|
/// </summary>
|
|
public static class DependencyInjection
|
|
{
|
|
/// <summary>
|
|
/// Registers Application Layer services (MediatR, FluentValidation, AutoMapper, Behaviors)
|
|
/// </summary>
|
|
public static IServiceCollection AddApplication(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var assembly = typeof(DependencyInjection).Assembly;
|
|
|
|
// Read LuckyPennySoft license key from appsettings.json
|
|
var licenseKey = configuration.GetValue<string>("LuckyPennySoftLicenseKey")
|
|
?? throw new InvalidOperationException("LuckyPennySoftLicenseKey not found in configuration");
|
|
|
|
// Register MediatR (scannt Assembly nach Handlers)
|
|
services.AddMediatR(config =>
|
|
{
|
|
config.LicenseKey = licenseKey;
|
|
config.RegisterServicesFromAssembly(assembly);
|
|
|
|
// Pipeline Behaviors (Reihenfolge wichtig!)
|
|
config.AddOpenBehavior(typeof(Common.Behaviors.ValidationBehavior<,>));
|
|
config.AddOpenBehavior(typeof(Common.Behaviors.LoggingBehavior<,>));
|
|
});
|
|
|
|
// Register FluentValidation (scannt Assembly nach Validators)
|
|
services.AddValidatorsFromAssembly(assembly);
|
|
|
|
// Register AutoMapper (scannt Assembly nach Profiles)
|
|
services.AddAutoMapper(cfg => {
|
|
cfg.LicenseKey = licenseKey;
|
|
}, typeof(Common.Mapping.MappingProfile));
|
|
|
|
return services;
|
|
}
|
|
}
|