using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; namespace PhoenixLib.DAL.EFCore.PGSQL.Extensions { public static class ServiceCollectionExtensions { public static void TryAddStringRepository(this IServiceCollection services) where TEntity : class, IStringKeyEntity, new() where TDbContext : DbContext { services.TryAddTransient, GenericStringRepository>(); } public static void TryAddLongRepository(this IServiceCollection services) where TEntity : class, ILongEntity, new() where TDto : class, ILongDto, new() where TDbContext : DbContext { services.TryAddLongRepository(); services.TryAddTransient, GenericMappedLongRepository>(); } public static void TryAddLongRepository(this IServiceCollection services) where TEntity : class, ILongEntity, new() where TDbContext : DbContext { services.TryAddTransient, GenericLongRepository>(); } public static void TryAddOldMappedLongRepository(this IServiceCollection services) where TEntity : class, ILongEntity, new() where TDto : class, ILongDto, new() where TDbContext : DbContext { services.TryAddTransient, GenericOldMappedLongRepository>(); } public static void TryAddUuidRepository(this IServiceCollection services) where TEntity : class, IUuidEntity, new() where TDto : class, IUuidDto, new() where TDbContext : DbContext { services.TryAddUuidRepository(); services.TryAddTransient, GenericMappedUuidRepository>(); } public static void TryAddUuidRepository(this IServiceCollection services) where TEntity : class, IUuidEntity, new() where TDbContext : DbContext { services.TryAddTransient, GenericUuidRepository>(); } public static void TryAddOldMappedUuidRepository(this IServiceCollection services) where TEntity : class, IUuidEntity, new() where TDto : class, IUuidDto, new() where TDbContext : DbContext { services.TryAddTransient, GenericOldMappedUuidRepository>(); } public static void TryAddIntRepository(this IServiceCollection services) where TEntity : class, IIntEntity, new() where TDto : class, IIntDto, new() where TDbContext : DbContext { services.TryAddIntRepository(); services.TryAddTransient, GenericMappedIntRepository>(); } public static void TryAddIntRepository(this IServiceCollection services) where TEntity : class, IIntEntity, new() where TDbContext : DbContext { services.TryAddTransient, GenericIntRepository>(); } public static void TryAddOldMappedIntRepository(this IServiceCollection services) where TEntity : class, IIntEntity, new() where TDto : class, IIntDto, new() where TDbContext : DbContext { services.TryAddTransient, GenericOldMappedIntRepository>(); } } }