refactor(di): unify Application and Infrastructure DI registrations under a central method
- Added central AddEnvelopeGenerator extension to aggregate existing DI setups - Introduced EGConfiguration for modular service registration - Standardized configuration pattern for Application and Infrastructure layers - Simplified distributed cache and localization registration
This commit is contained in:
@@ -38,10 +38,10 @@ namespace EnvelopeGenerator.Infrastructure
|
||||
/// will be created per HTTP request (or per scope) within the dependency injection container.
|
||||
/// </remarks>
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddEnvelopeGeneratorInfrastructureServices(this IServiceCollection services, Action<Config> options)
|
||||
public static IServiceCollection AddEGInfrastructureServices(this IServiceCollection services, Action<EGInfrastructureConfiguration> options)
|
||||
{
|
||||
// configure custom options
|
||||
options(new Config(services));
|
||||
options(new EGInfrastructureConfiguration(services));
|
||||
#if NET
|
||||
services.TryAddScoped<IConfigRepository, ConfigRepository>();
|
||||
services.TryAddScoped<IDocumentReceiverElementRepository, DocumentReceiverElementRepository>();
|
||||
@@ -160,11 +160,11 @@ namespace EnvelopeGenerator.Infrastructure
|
||||
}
|
||||
#endif
|
||||
|
||||
public class Config
|
||||
public class EGInfrastructureConfiguration
|
||||
{
|
||||
private readonly IServiceCollection _services;
|
||||
|
||||
internal Config(IServiceCollection services)
|
||||
internal EGInfrastructureConfiguration(IServiceCollection services)
|
||||
{
|
||||
_services = services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user