using DigitalData.Core.Abstractions.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace DigitalData.Core.Infrastructure; public class EntityConfigurationOptions { private readonly IServiceCollection _services; public EntityConfigurationOptions(IServiceCollection services) { _services = services; } public EntityConfigurationOptions AddCustomMapper(Action configure, Func? factory = null) where TEntityMapper : class, IEntityMapper { configure(_services); if (factory is null) _services.AddSingleton, TEntityMapper>(); else _services.AddSingleton(factory); return this; } }