Migrating to modern c# namespace

Using the short namesapce declaration for conciseness
This commit is contained in:
kdeng00
2023-04-09 12:34:06 -04:00
parent 37cfda84b5
commit c17c9cd329
48 changed files with 3402 additions and 3454 deletions
+22 -23
View File
@@ -6,32 +6,31 @@ using Microsoft.EntityFrameworkCore;
using Icarus.Models;
namespace Icarus.Database.Contexts
namespace Icarus.Database.Contexts;
public class CoverArtContext : DbContext
{
public class CoverArtContext : DbContext
public DbSet<CoverArt> CoverArtImages { get; set; }
public CoverArtContext(DbContextOptions<CoverArtContext> options) : base(options) { }
public CoverArtContext(string connString) : base(new DbContextOptionsBuilder<CoverArtContext>()
.UseMySQL(connString).Options)
{
public DbSet<CoverArt> CoverArtImages { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<CoverArt>()
.ToTable("CoverArt");
}
public CoverArtContext(DbContextOptions<CoverArtContext> options) : base(options) { }
public CoverArtContext(string connString) : base(new DbContextOptionsBuilder<CoverArtContext>()
.UseMySQL(connString).Options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<CoverArt>()
.ToTable("CoverArt");
}
public CoverArt RetrieveRecord(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID);
}
public CoverArt RetrieveRecord(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID);
}
public bool DoesRecordExist(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID) != null ? true : false;
}
public bool DoesRecordExist(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID) != null ? true : false;
}
}