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,35 +1,33 @@
using System.Threading.Tasks;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace ErsatzTV.Infrastructure.Data.Repositories
namespace ErsatzTV.Infrastructure.Data.Repositories;
public class FFmpegProfileRepository : IFFmpegProfileRepository
{
public class FFmpegProfileRepository : IFFmpegProfileRepository
private readonly IDbContextFactory<TvContext> _dbContextFactory;
public FFmpegProfileRepository(IDbContextFactory<TvContext> dbContextFactory) =>
_dbContextFactory = dbContextFactory;
public async Task<FFmpegProfile> Copy(int ffmpegProfileId, string name)
{
private readonly IDbContextFactory<TvContext> _dbContextFactory;
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
FFmpegProfile ffmpegProfile = await dbContext.FFmpegProfiles.FindAsync(ffmpegProfileId);
public FFmpegProfileRepository(IDbContextFactory<TvContext> dbContextFactory) =>
_dbContextFactory = dbContextFactory;
PropertyValues values = dbContext.Entry(ffmpegProfile).CurrentValues.Clone();
values["Id"] = 0;
public async Task<FFmpegProfile> Copy(int ffmpegProfileId, string name)
{
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
FFmpegProfile ffmpegProfile = await dbContext.FFmpegProfiles.FindAsync(ffmpegProfileId);
var clone = new FFmpegProfile();
await dbContext.AddAsync(clone);
dbContext.Entry(clone).CurrentValues.SetValues(values);
clone.Name = name;
PropertyValues values = dbContext.Entry(ffmpegProfile).CurrentValues.Clone();
values["Id"] = 0;
await dbContext.SaveChangesAsync();
await dbContext.Entry(clone).Reference(f => f.Resolution).LoadAsync();
var clone = new FFmpegProfile();
await dbContext.AddAsync(clone);
dbContext.Entry(clone).CurrentValues.SetValues(values);
clone.Name = name;
await dbContext.SaveChangesAsync();
await dbContext.Entry(clone).Reference(f => f.Resolution).LoadAsync();
return clone;
}
return clone;
}
}
}