#93: Reduce build errors
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Icarus.Database.Contexts;
|
||||
|
||||
public class AlbumContext : DbContext
|
||||
{
|
||||
public DbSet<Album> Albums { get; set; }
|
||||
public DbSet<Album>? Albums { get; set; }
|
||||
|
||||
public AlbumContext(DbContextOptions<AlbumContext> options) : base(options) { }
|
||||
public AlbumContext(string connString) : base(new DbContextOptionsBuilder<AlbumContext>()
|
||||
@@ -22,11 +22,12 @@ public class AlbumContext : DbContext
|
||||
|
||||
public Album RetrieveRecord(Album album)
|
||||
{
|
||||
return Albums.FirstOrDefault(alb => alb.Id == album.Id);
|
||||
var albm = Albums!.FirstOrDefault(alb => alb.Id == album.Id);
|
||||
return albm!;
|
||||
}
|
||||
|
||||
public bool DoesRecordExist(Album album)
|
||||
{
|
||||
return Albums.FirstOrDefault(alb => alb.Id == album.Id) != null ? true : false;
|
||||
return Albums!.FirstOrDefault(alb => alb.Id == album.Id) != null ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ArtistContext : DbContext
|
||||
public Artist RetrieveRecord(Artist artist)
|
||||
{
|
||||
|
||||
return Artists.FirstOrDefault(arst => arst.Id == artist.Id);
|
||||
return Artists.FirstOrDefault(arst => arst.Id == artist.Id)!;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ namespace Icarus.Database.Contexts;
|
||||
|
||||
public class CoverArtContext : DbContext
|
||||
{
|
||||
public DbSet<CoverArt> CoverArtImages { get; set; }
|
||||
#region Properties
|
||||
public DbSet<CoverArt>? CoverArtImages { get; set; }
|
||||
#endregion
|
||||
|
||||
public CoverArtContext(DbContextOptions<CoverArtContext> options) : base(options) { }
|
||||
public CoverArtContext(string connString) : base(new DbContextOptionsBuilder<CoverArtContext>()
|
||||
@@ -22,11 +24,11 @@ public class CoverArtContext : DbContext
|
||||
|
||||
public CoverArt RetrieveRecord(CoverArt cover)
|
||||
{
|
||||
return CoverArtImages.FirstOrDefault(cov => cov.Id == cover.Id);
|
||||
return CoverArtImages!.FirstOrDefault(cov => cov.Id == cover.Id)!;
|
||||
}
|
||||
|
||||
public bool DoesRecordExist(CoverArt cover)
|
||||
{
|
||||
return CoverArtImages.FirstOrDefault(cov => cov.Id == cover.Id) != null ? true : false;
|
||||
return CoverArtImages!.FirstOrDefault(cov => cov.Id == cover.Id) != null ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ namespace Icarus.Database.Contexts;
|
||||
|
||||
public class GenreContext : DbContext
|
||||
{
|
||||
public DbSet<Genre> Genres { get; set; }
|
||||
#region Properties
|
||||
public DbSet<Genre>? Genres { get; set; }
|
||||
#endregion
|
||||
|
||||
public GenreContext(DbContextOptions<GenreContext> options) : base(options) { }
|
||||
public GenreContext(string connString) : base(new DbContextOptionsBuilder<GenreContext>()
|
||||
.UseMySQL(connString).Options)
|
||||
@@ -22,11 +25,12 @@ public class GenreContext : DbContext
|
||||
|
||||
public Genre RetrieveRecord(Genre genre)
|
||||
{
|
||||
return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id);
|
||||
var gnre = Genres!.FirstOrDefault(gnr => gnr.Id == genre.Id);
|
||||
return gnre!;
|
||||
}
|
||||
|
||||
public bool DoesRecordExist(Genre genre)
|
||||
{
|
||||
return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id) != null ? true : false;
|
||||
return Genres!.FirstOrDefault(gnr => gnr.Id == genre.Id) != null ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Icarus.Database.Contexts;
|
||||
|
||||
public class SongContext : DbContext
|
||||
{
|
||||
public DbSet<Song> Songs { get; set; }
|
||||
public DbSet<Song>? Songs { get; set; }
|
||||
|
||||
public SongContext(string connString) : base(new DbContextOptionsBuilder<SongContext>()
|
||||
.UseMySQL(connString).Options)
|
||||
@@ -41,12 +41,13 @@ public class SongContext : DbContext
|
||||
|
||||
public Song RetrieveRecord(Song song)
|
||||
{
|
||||
return Songs.FirstOrDefault(sng => sng.Id == song.Id);
|
||||
var sng = Songs!.FirstOrDefault(sng => sng.Id == song.Id);
|
||||
return sng!;
|
||||
}
|
||||
|
||||
|
||||
public bool DoesRecordExist(Song song)
|
||||
{
|
||||
return Songs.FirstOrDefault(sng => sng.Id == song.Id) != null ? true : false;
|
||||
return Songs!.FirstOrDefault(sng => sng.Id == song.Id) != null ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class UserContext : DbContext
|
||||
|
||||
public User RetrieveRecord(User user)
|
||||
{
|
||||
return Users.FirstOrDefault(usr => usr.Id == user.Id);
|
||||
return Users.FirstOrDefault(usr => usr.Id == user.Id)!;
|
||||
}
|
||||
|
||||
public bool DoesRecordExist(User user)
|
||||
|
||||
Reference in New Issue
Block a user