refactor namespaces and imports (#670)

* re-namespace

* optimize usings

* more usings

* more of the same

* more implicit/global usings

* cleanup all usings

* minor fixes
This commit is contained in:
Jason Dove
2022-03-03 15:36:07 -06:00
committed by GitHub
parent 748581bf5a
commit 1ab98578ab
1164 changed files with 50127 additions and 53816 deletions
@@ -1,30 +1,25 @@
using System.Threading;
using System.Threading.Tasks;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using LanguageExt;
using MediatR;
using Microsoft.EntityFrameworkCore;
using static ErsatzTV.Application.ProgramSchedules.Mapper;
namespace ErsatzTV.Application.ProgramSchedules.Queries
namespace ErsatzTV.Application.ProgramSchedules;
public class GetProgramScheduleByIdHandler :
IRequestHandler<GetProgramScheduleById, Option<ProgramScheduleViewModel>>
{
public class GetProgramScheduleByIdHandler :
IRequestHandler<GetProgramScheduleById, Option<ProgramScheduleViewModel>>
private readonly IDbContextFactory<TvContext> _dbContextFactory;
public GetProgramScheduleByIdHandler(IDbContextFactory<TvContext> dbContextFactory) =>
_dbContextFactory = dbContextFactory;
public async Task<Option<ProgramScheduleViewModel>> Handle(
GetProgramScheduleById request,
CancellationToken cancellationToken)
{
private readonly IDbContextFactory<TvContext> _dbContextFactory;
public GetProgramScheduleByIdHandler(IDbContextFactory<TvContext> dbContextFactory) =>
_dbContextFactory = dbContextFactory;
public async Task<Option<ProgramScheduleViewModel>> Handle(
GetProgramScheduleById request,
CancellationToken cancellationToken)
{
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.ProgramSchedules
.SelectOneAsync(ps => ps.Id, ps => ps.Id == request.Id)
.MapT(ProjectToViewModel);
}
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.ProgramSchedules
.SelectOneAsync(ps => ps.Id, ps => ps.Id == request.Id)
.MapT(ProjectToViewModel);
}
}
}