diff --git a/src/FilterLists.Services/FilterList/FilterListService.cs b/src/FilterLists.Services/FilterList/FilterListService.cs index e511be0a1..7f015f3f2 100644 --- a/src/FilterLists.Services/FilterList/FilterListService.cs +++ b/src/FilterLists.Services/FilterList/FilterListService.cs @@ -12,15 +12,16 @@ namespace FilterLists.Services.FilterList [UsedImplicitly] public class FilterListService : Service { - public FilterListService(FilterListsDbContext dbContext, IMapper mapper) : base(dbContext, mapper) + public FilterListService(FilterListsDbContext dbContext, IConfigurationProvider configurationProvider) : + base(dbContext, configurationProvider) { } public async Task> GetAllSummariesAsync() => - await DbContext.FilterLists.ProjectTo(Mapper.ConfigurationProvider).ToListAsync(); + await DbContext.FilterLists.ProjectTo(ConfigurationProvider).ToListAsync(); public async Task GetDetailsAsync(uint id) => - await DbContext.FilterLists.ProjectTo(Mapper.ConfigurationProvider) + await DbContext.FilterLists.ProjectTo(ConfigurationProvider) .FirstOrDefaultAsync(x => x.Id == id) .FilterParentListFromMaintainerAdditionalLists(); } diff --git a/src/FilterLists.Services/Seed/SeedService.cs b/src/FilterLists.Services/Seed/SeedService.cs index b47b02a5a..c3a72da8a 100644 --- a/src/FilterLists.Services/Seed/SeedService.cs +++ b/src/FilterLists.Services/Seed/SeedService.cs @@ -13,18 +13,19 @@ namespace FilterLists.Services.Seed [UsedImplicitly] public class SeedService : Service { - public SeedService(FilterListsDbContext dbContext, IMapper mapper) : base(dbContext, mapper) + public SeedService(FilterListsDbContext dbContext, IConfigurationProvider configurationProvider) + : base(dbContext, configurationProvider) { } public async Task> GetAllAsync() where TEntity : class => - await DbContext.Set().ProjectTo(Mapper.ConfigurationProvider).ToArrayAsync(); + await DbContext.Set().ProjectTo(ConfigurationProvider).ToArrayAsync(); public async Task> GetAllAsync(PropertyInfo primarySort) where TEntity : class => await DbContext.Set() .OrderBy(x => primarySort.GetValue(x, null)) - .ProjectTo(Mapper.ConfigurationProvider) + .ProjectTo(ConfigurationProvider) .ToArrayAsync(); public async Task> GetAllAsync(PropertyInfo primarySort, @@ -32,7 +33,7 @@ public async Task> GetAllAsync(Property await DbContext.Set() .OrderBy(x => primarySort.GetValue(x, null)) .ThenBy(x => secondarySort.GetValue(x, null)) - .ProjectTo(Mapper.ConfigurationProvider) + .ProjectTo(ConfigurationProvider) .ToArrayAsync(); } } \ No newline at end of file diff --git a/src/FilterLists.Services/Service.cs b/src/FilterLists.Services/Service.cs index 95833800f..702feefbf 100644 --- a/src/FilterLists.Services/Service.cs +++ b/src/FilterLists.Services/Service.cs @@ -7,15 +7,15 @@ namespace FilterLists.Services [UsedImplicitly] public class Service { + protected readonly IConfigurationProvider ConfigurationProvider; protected readonly FilterListsDbContext DbContext; - protected readonly IMapper Mapper; public Service(FilterListsDbContext dbContext) => DbContext = dbContext; - public Service(FilterListsDbContext dbContext, IMapper mapper) + public Service(FilterListsDbContext dbContext, IConfigurationProvider configurationProvider) { DbContext = dbContext; - Mapper = mapper; + ConfigurationProvider = configurationProvider; } } } \ No newline at end of file diff --git a/src/FilterLists.Services/Snapshot/SnapshotService.cs b/src/FilterLists.Services/Snapshot/SnapshotService.cs index 2f10236ea..1e2b302d7 100644 --- a/src/FilterLists.Services/Snapshot/SnapshotService.cs +++ b/src/FilterLists.Services/Snapshot/SnapshotService.cs @@ -19,7 +19,8 @@ public class SnapshotService : Service private static readonly IList IgnoreLists = new ReadOnlyCollection(new List {48, 149, 173, 185, 186, 187, 188, 189, 352}); - public SnapshotService(FilterListsDbContext dbContext, IMapper mapper) : base(dbContext, mapper) + public SnapshotService(FilterListsDbContext dbContext, IConfigurationProvider configurationProvider) + : base(dbContext, configurationProvider) { } @@ -49,7 +50,7 @@ await DbContext .ThenBy(list => list.Snapshots.Select(ss => ss.CreatedDateUtc).OrderByDescending(sscd => sscd).FirstOrDefault()) .Take(batchSize) - .ProjectTo(Mapper.ConfigurationProvider) + .ProjectTo(ConfigurationProvider) .ToListAsync(); private IEnumerable GetSnapshots(IEnumerable lists) =>