mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(svcs): ♻🔥⚡ rm some unnecessary thread context switching
This commit is contained in:
parent
0f136a8599
commit
9d73f9731f
8 changed files with 30 additions and 30 deletions
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetLanguages
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<LanguageVm>>
|
||||
public class Query : IRequest<List<LanguageVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<LanguageVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<LanguageVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LanguageVm>> Handle(
|
||||
public Task<List<LanguageVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Languages
|
||||
return _context.Languages
|
||||
.Where(l => l.FilterListLanguages.Any())
|
||||
.OrderBy(l => l.Iso6391)
|
||||
.ProjectTo<LanguageVm>(_mapper.ConfigurationProvider)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetLicenses
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<LicenseVm>>
|
||||
public class Query : IRequest<List<LicenseVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<LicenseVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<LicenseVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LicenseVm>> Handle(
|
||||
public Task<List<LicenseVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Licenses
|
||||
return _context.Licenses
|
||||
.OrderBy(l => l.Id)
|
||||
.ProjectTo<LicenseVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<ListDetailsVm?> Handle(
|
||||
public Task<ListDetailsVm?> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.FilterLists
|
||||
return _context.FilterLists
|
||||
.ProjectTo<ListDetailsVm>(_mapper.ConfigurationProvider)
|
||||
.SingleOrDefaultAsync(fl => fl.Id == request.Id, cancellationToken);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetLists
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<ListVm>>
|
||||
public class Query : IRequest<List<ListVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<ListVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<ListVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -25,11 +25,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ListVm>> Handle(
|
||||
public Task<List<ListVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.FilterLists
|
||||
return _context.FilterLists
|
||||
.OrderBy(fl => fl.Id)
|
||||
.ProjectTo<ListVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetMaintainers
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<MaintainerVm>>
|
||||
public class Query : IRequest<List<MaintainerVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<MaintainerVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<MaintainerVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MaintainerVm>> Handle(
|
||||
public Task<List<MaintainerVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Maintainers
|
||||
return _context.Maintainers
|
||||
.OrderBy(m => m.Id)
|
||||
.ProjectTo<MaintainerVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetSoftware
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<SoftwareVm>>
|
||||
public class Query : IRequest<List<SoftwareVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<SoftwareVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<SoftwareVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SoftwareVm>> Handle(
|
||||
public Task<List<SoftwareVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Software
|
||||
return _context.Software
|
||||
.OrderBy(s => s.Id)
|
||||
.ProjectTo<SoftwareVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetSyntaxes
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<SyntaxVm>>
|
||||
public class Query : IRequest<List<SyntaxVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<SyntaxVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<SyntaxVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SyntaxVm>> Handle(
|
||||
public Task<List<SyntaxVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Syntaxes
|
||||
return _context.Syntaxes
|
||||
.OrderBy(s => s.Id)
|
||||
.ProjectTo<SyntaxVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ namespace FilterLists.Directory.Application.Queries;
|
|||
|
||||
public static class GetTags
|
||||
{
|
||||
public class Query : IRequest<IEnumerable<TagVm>>
|
||||
public class Query : IRequest<List<TagVm>>
|
||||
{
|
||||
}
|
||||
|
||||
internal class Handler : IRequestHandler<Query, IEnumerable<TagVm>>
|
||||
internal class Handler : IRequestHandler<Query, List<TagVm>>
|
||||
{
|
||||
private readonly IQueryContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
|
@ -24,11 +24,11 @@ public Handler(IQueryContext context, IMapper mapper)
|
|||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TagVm>> Handle(
|
||||
public Task<List<TagVm>> Handle(
|
||||
Query request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Tags
|
||||
return _context.Tags
|
||||
.OrderBy(t => t.Id)
|
||||
.ProjectTo<TagVm>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
|||
Loading…
Reference in a new issue