using DigitalData.Core.Abstractions.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using System.DirectoryServices; namespace DigitalData.Core.Infrastructure { public static class DIExtensions { /// /// Adds a CRUD repository for a specific entity type to the service collection. /// /// The entity type for which the repository is registered. /// The type of the entity's identifier. /// The DbContext type used by the repository. /// The to add the repository to. /// An optional action to configure additional services for the repository. /// The original instance, allowing further configuration. public static IServiceCollection AddCleanCRUDRepository(this IServiceCollection services, Action? configureRepository = null) where TCRUDRepository : CRUDRepository where TEntity : class where TDbContext : DbContext { services.AddScoped, TCRUDRepository>(); configureRepository?.Invoke(services); return services; } } }